Export a SAS Data Set into a Text fileExporting the data into a Text file is similar to an Excel spreadsheet.
Example
Proc Export Data=Income
OutFile='/folders/myfolders/Income.txt'
Replace
Dbms=tab;
Run;
[Note: The code above might get cut off due to shortened screen's width. Expand the web page for this session if needed.]
Pay attention to the following when exporting to a Text file:
1. File Extension
Use (.txt) as the file extension when exporting to a Text file.
2. DBMS option
You can use the DBMS option to select the type of delimiter when exporting to a Text file.
DBMS=tab
This will create a tab-delimited file.
DBMS=csv
This will create a comma-delimited file.
(try it!)
Exercise
Export the ELECTRIC data set into a Text file.
Use Tab as the data delimiter.
Need some help?
HINT:
Remember to change the file extension from (xls) to (txt).
SOLUTION:
Proc Export Data=SASHelp.Electric
OutFile='/folders/myfolders/Electric.txt'
Replace
Dbms=tab;
Run;
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |