BookmarkSubscribeRSS Feed
hwangnyc
Quartz | Level 8

Hi all,

 

Lets say I have 3 data sets:

 

Data1, Data2, Data3

 

and I want to export it to a excel file called AllData

 

And have 3 sheets: Data1 (containing all the information from Data1), Data2, Data3.

 

Is this possible?

 

Thanks! 

3 REPLIES 3
PBsas
Obsidian | Level 7

You can use proc export or ODS:

 

proc export data=table1 out="path/filename.xlsx"  dbms=xlsx replace; sheet="sheet_name1";run; 

proc export data=table2 out="path/filename.xlsx"  dbms=xlsx replace; sheet="sheet_name2";run; 

proc export data=table3 out="path/filename.xlsx"  dbms=xlsx replace; sheet="sheet_name3";run; 

 

Remember to have same output file name otherwise will create different files.

SASKiwi
PROC Star

You can also use the Excel LIBNAME engine and PROC DATASETS.

Reeza
Super User
Libname outXL XLSX 'path to excel file.xlsx';

Proc datasets library=work nodetails nolist;
Copy in=work out=outXL;
Select data1-data3;
Run;quit;

Libname outXL;

If on SAS 9.4 M3 you can also use ODS EXCEL 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 11073 views
  • 1 like
  • 4 in conversation