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

Hi folks,

 

I need to generate an Excel file with more than one sheet. In each sheet, I have multiples reports (generated by proc tabulate), one below other. It's very important that the reports are one below other.

 

I tried the following code but it generates one sheet only with all reports (one below other) and not two sheets as required.

 

ODS EXCEL FILE="/Test.xlsx" 
    OPTIONS(START_AT="1,3" SHEET_INTERVAL="none" EMBED_TITLES_ONCE='yes' embedded_titles="yes" SHEET_NAME="Archivo 1") STYLE=Daisy;

/*Report 1*/
PROC TABULATE DATA=SASHELP.CLASS ;	
	VAR Age;
	CLASS Sex /	ORDER=UNFORMATTED MISSING;
	TABLE Sex,
		  N 
          Age*Sum ;
RUN;

/*Report 2*/
PROC TABULATE DATA=SASHELP.CLASS ;	
	VAR Age;
	CLASS Sex /	ORDER=UNFORMATTED MISSING;
	TABLE Sex,
		  N 
          Age*Sum ;
RUN;

ODS EXCEL OPTIONS (START_AT="1,3" SHEET_INTERVAL="none" EMBED_TITLES_ONCE='yes' embedded_titles="yes" SHEET_NAME="Archivo 2") STYLE=Daisy;
/*Report 3*/
PROC TABULATE DATA=SASHELP.CLASS ;	
	VAR Age;
	CLASS Sex /	ORDER=UNFORMATTED MISSING;
	TABLE Sex,
		  N 
          Age*Sum ;
RUN;

/*Report 4*/
PROC TABULATE DATA=SASHELP.CLASS ;	
	VAR Age;
	CLASS Sex /	ORDER=UNFORMATTED MISSING;
	TABLE Sex,
		  N 
          Age*Sum ;
RUN;


ODS _ALL_ CLOSE;

I tried removing the option  SHEET_INTERVAL="none" but it generate a sheet per proc tabulate, instead only two sheets. Any suggestion? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Have you tried setting sheet_interval to NOW when you want the new page. Also, which version of SAS do you have? This was a known bug in a specific version, before TS1M4 I believe.


https://documentation.sas.com/?docsetId=odsug&docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&docsetVe...

View solution in original post

5 REPLIES 5
Reeza
Super User
Have you tried setting sheet_interval to NOW when you want the new page. Also, which version of SAS do you have? This was a known bug in a specific version, before TS1M4 I believe.


https://documentation.sas.com/?docsetId=odsug&docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&docsetVe...
MariaD
Barite | Level 11

Thanks @Reeza ! One more question... I'm using "Daisy" style, but my only problem is I need the title align to the left and in this style align to center. I tried to add "align" option on title but it has not effect Any suggestion?

 

Regards, 

Reeza
Super User
I believe the setting you want is justification.

title j=l 'My title';
MariaD
Barite | Level 11

@Reeza , yes, I tried it but it's completely ignored, the title remains on center.

Reeza
Super User
Is the J=L before the text or after?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 3326 views
  • 0 likes
  • 2 in conversation