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 -
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 25. Read more here about why you should contribute and what is in it for you!
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.