Export a SAS Data Set into a text file
Exporting data into a text file is similar to exporting data to an Excel spreadsheet.
Example
Proc Export Data=Income
OutFile='/home/your_user_name/Income.txt'
Replace
Dbms=tab;
Run;
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 a tab as the data delimiter.
Need some help?
HINT:
Remember to change the file extension from (xlsx) to (txt).
SOLUTION:
Proc Export Data=SASHelp.Electric
OutFile=’/home/your_user_name/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. |