Exporting SAS data set to excel
To export the data set you created in SAS to excel simply write the following:
PROC EXPORT DATA= LIBRARY.DATA_SET
OUTFILE= "DIRECTORY"
DBMS=EXCEL REPLACE;
SHEET=" WORK_SHEET_NAME";
RUN;
- In first line above, we are specifying which data set to get by specifying the library and the data set name.
- The second line is where we will specify our output location.
- The third line has the word REPLACE. If we want to replace our previous output with our new one every time we execute the statement, leave this here.
- The fourth line SHEET=".." will contain the name of the sheet. If you don't want to replace the work sheet every time you run the program and you want to archive your old results, you can always change your SHEET name every time you run the program.
Actual Example:
PROC EXPORT DATA= WORK.SALES_FIG
OUTFILE= "C:\SAS\SALES\DATA_OUT"
DBMS=EXCEL REPLACE;
SHEET="SALES_SUMMARY";
RUN;
Tags: