Data Set [13-14]

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?

Get Hint

Get Solution