BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bzubrick
Obsidian | Level 7

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;



1 ACCEPTED SOLUTION

Accepted Solutions
DaveHorne
SAS Employee

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

2 REPLIES 2
DaveHorne
SAS Employee

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

bzubrick
Obsidian | Level 7

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

 

HeartHeartHeart

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 1116 views
  • 2 likes
  • 2 in conversation