Hello, I'm trying to export data from a SAS table to different sheets based on a variable's values (variable=site). I also need to sort by a few variables (date and type) before export, which is the reason I cannot use the code below.
ods excel file="\\filepath\file.xlsx"
options(sheet_interval="BYGROUP");
proc print data=doc noobs;
by site ;
run;
ods excel close;
@jmmedina252 wrote:
Hello, I'm trying to export data from a SAS table to different sheets based on a variable's values (variable=site). I also need to sort by a few variables (date and type) before export, which is the reason I cannot use the code below.
ods excel file="\\filepath\file.xlsx"
options(sheet_interval="BYGROUP");
proc print data=doc noobs;
by site ;
run;
ods excel close;
What exactly makes you think that you can't use this?? If you Sort the data by SITE DATE and TYPE then the result of Print by Site is one sheet per site with the data in Date and Type order.
You are not successfully describing what your output requirement might be.
Hi,
Excel sheets can be created like this:
Proc Export data=sashelp.class
outfile="C:\Temp\yourFile.xlsx"
dbms=EXCEL
Replace;
sheet='Class';
run;
Simply repeat the operation for several sheets
- Cheers -
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.