Data Set [12-14]

Export a SAS Data Set into Excel spreadsheetYou often need to export the data set into an Excel spreadsheet. 

This can be done easily by using a procedure called PROC EXPORT


Proc Export Data=Income 

[Note: The code above might get cut off due to shortened screen width. Expand the web page for this session if needed.]

Proc Export is a procedure that allows you to export SAS data set into an external file such as Excel spreadsheet or Text file. 

You should include these 3 options when using Proc Export:

1. OUTFILE option
The OUTFILE option lets you specify the exporting file. In our example, the data is exported into Income.xls

2. REPLACE option
The REPLACE option allows you to overwrite the exporting file if it already exists in the stated directory path. It is recommended to always include this option when using PROC EXPORT.

3. DBMS option
The DBMS option specifies the type of file for the exporting file. In our example, we use the DBMS option to tell SAS to export the data set into an Excel spreadsheet (xls). 


Now, run the code from the example above.

The INCOME data set (created from one of our previous exercises) will then be exported into an Excel spreadsheet:


Locate the ELECTRIC data set from the SASHelp library.

Export ELECTRIC into an Excel spreadsheet.

Ensure the Excel spreadsheet contains the same rows and columns as the SAS data set.

Need some help?

Get Hint

Get Solution