The SAS Output Delivery System and reporting techniques

Use Proc Print to put multiple SAS outputs in one table

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

Use Proc Print to put multiple SAS outputs in one table

I use SAS to create 3 data sets. then I use PROC PRINT per the code below to create 3 excel files which show their data. Is there anyway to make a statement that puts all 3 data sets as diffferent tabs in the same excel file???

 

 

ods excel file='D:\qsilver\SAS Data\BZ\3_Output\TotalOutput5k.xlsx' style=meadows;
Proc print data=work.histodata_Total noobs label;
run;
ods excel close;



ods excel file='D:\qsilver\SAS Data\BZ\3_Output\RefiOutput5k.xlsx' style=meadows;
Proc print data=work.histodata_refi noobs label;
run;
ods excel close;


ods excel file='D:\qsilver\SAS Data\BZ\3_Output\PurchaseOutput5k.xlsx' style=meadows;
Proc print data=work.histodata_purchase noobs label;
run;
ods excel close;




Accepted Solutions
Solution
‎08-16-2017 02:45 PM
SAS Employee
Posts: 9

Re: Use Proc Print to put multiple SAS outputs in one table

One way is via the XLSX engine:

 

libname xlout XLSX 'D:\qsilver\SAS Data\BZ\3_Output\Output5k.xlsx';

data xlout.Total;
  set work.histodata_Total;
run;

data xlout.Refi;
  set work.histodata_Refi;
run;

data xlout.Purchase;
  set work.histodata_Purchase;
run;

libname xlout clear;

See Chris' blog post for more details: Using LIBNAME XLSX to read and write Excel files

View solution in original post


All Replies
Solution
‎08-16-2017 02:45 PM
SAS Employee
Posts: 9

Re: Use Proc Print to put multiple SAS outputs in one table

One way is via the XLSX engine:

 

libname xlout XLSX 'D:\qsilver\SAS Data\BZ\3_Output\Output5k.xlsx';

data xlout.Total;
  set work.histodata_Total;
run;

data xlout.Refi;
  set work.histodata_Refi;
run;

data xlout.Purchase;
  set work.histodata_Purchase;
run;

libname xlout clear;

See Chris' blog post for more details: Using LIBNAME XLSX to read and write Excel files

Occasional Contributor
Posts: 16

Re: Use Proc Print to put multiple SAS outputs in one table

Posted in reply to DaveHorne

Genius! Exactly what I needed, thank you!!!

 

HeartHeartHeart

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 230 views
  • 2 likes
  • 2 in conversation