BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASMom2
Fluorite | Level 6

Hello, I need some help. I have 8 tables/datasets in SAS that I want to export to Excel using ODS Excel. They all need to go in one excel file with three tabs. Out of these 8 tables, 4 need to go in the 1st tab, two in the 2nd tab and last two need to go in the 3rd tab. I know how to have either all tables in one tab (using sheet_interval='NONE') or have all the tables in a separate tab (using sheet_interval='YES')  but I do not know how to accomplish what I need to do. 

I appreciate your help.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
ods excel file='c:\temp\temp.xlsx' options(sheet_name='First Tab' sheet_interval='none');
/*First table*/
proc print data=sashelp.class;run;
/*Second table*/
proc print data=sashelp.class;run;

ods excel options(sheet_name='Second Tab' sheet_interval='proc');
/*Third table*/
proc print data=sashelp.class(obs=4);run;
ods excel options(sheet_interval='none');
/*Fourth table*/
proc print data=sashelp.class(obs=4);run;

ods excel options(sheet_name='Third Tab' sheet_interval='proc');
/*Fifth table*/
proc print data=sashelp.class(obs=8);run;
ods excel options(sheet_interval='none');
/*Sixth table*/
proc print data=sashelp.class(obs=8);run;

ods excel close;

View solution in original post

2 REPLIES 2
Ksharp
Super User
ods excel file='c:\temp\temp.xlsx' options(sheet_name='First Tab' sheet_interval='none');
/*First table*/
proc print data=sashelp.class;run;
/*Second table*/
proc print data=sashelp.class;run;

ods excel options(sheet_name='Second Tab' sheet_interval='proc');
/*Third table*/
proc print data=sashelp.class(obs=4);run;
ods excel options(sheet_interval='none');
/*Fourth table*/
proc print data=sashelp.class(obs=4);run;

ods excel options(sheet_name='Third Tab' sheet_interval='proc');
/*Fifth table*/
proc print data=sashelp.class(obs=8);run;
ods excel options(sheet_interval='none');
/*Sixth table*/
proc print data=sashelp.class(obs=8);run;

ods excel close;

SASMom2
Fluorite | Level 6

Thank you for your help! It worked beautifully!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3567 views
  • 0 likes
  • 2 in conversation