SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
aneeshv
Fluorite | Level 6

Team,

 

I am trying to generate Excel report with multiple sheet. for this i am using the below given code. My problem is even though i am specifying multiple sheet name in the code, All are coming in a single sheet.

 

ods excel file="Operationsreport.xls" ;

ods excel OPTIONS (

embedded_titles="yes"

sheet_interval="none"

sheet_name="Account Opening"

)

 

proc sql;

select item_desc ,field1 ,field2

from table1

order by item_code;

proc sql;

select item_desc ,field1 ,field2

from table2

order by item_code;

quit;

run;

 

ods excel OPTIONS (

embedded_titles="yes"

sheet_interval="none"

sheet_name="Modification Process"

);

 

proc sql;

select item_desc ,field1 ,field2

from table3

order by item_code;

 

proc sql;

select item_desc ,field1 ,field2

from table4

order by item_code;

 

quit;

run;

 

ods _all_ close;

 

 

The sheet_interval="none" option is not working i guess.

 

Please guide.

 

regards,

Aneesh

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sheet_interval="none" means that there will be no sheet_intervals, i.e. all output appears on one sheet.  I would guess (and haven't time to check) that you really want sheet_interval="proc" or something like that so each procedures output appears on a new sheet.  

aneeshv
Fluorite | Level 6
Thanks for the reply.

Our actual requirement is to print multiple proc outputs into a single sheet.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, I am confused.  You initial post:

---

I am trying to generate Excel report with multiple sheet. for this i am using the below given code. My problem is even though i am specifying multiple sheet name in the code, All are coming in a single sheet.

---

 

Is the exacy opposite of what you post now?  If you want all in one sheet, then sheet_interval="none" and don't specify sheet name options in each block.  If you want separate output sheets, then sheet_interval="proc" and specify sheet_name in each instance.

aneeshv
Fluorite | Level 6

Sorry for the confusion.

My actual requirement is multiple sheet with different tables in each sheet.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just change to:

ods excel file="Operationsreport.xls"  options(
  embedded_titles="yes"
  sheet_interval="proc"
  sheet_name="Account Opening")

And only set it once at the top.  Each further change in sheet name should only look like:

ods excel options(sheet_name="Modification Process");
Reeza
Super User

There is a bug in ODS EXCEL that controls how pages are generated. 

 

If you search on here I posted a workaround, it's also on an blog post from Chris Hemedinger

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 6 replies
  • 1740 views
  • 0 likes
  • 3 in conversation