BookmarkSubscribeRSS Feed
Daniela_P
Obsidian | Level 7

Dear experts,

I'd like to change the default number of the sheets when I use tagsets.excelxp with a proc tabulate and different table instructions inside.

I'd like to avoid the alternative way to create many proc tabulate as many tables I have to do...

Is there any option/code to do it?

Thanks in advance.

Daniela

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry you will need to be clearer in your description, I am not understanding what you mean by "default number" of sheets?  Specify what you are doing with code and required output.

Daniela_P
Obsidian | Level 7

The problem is when I write a lot of table inside the same proc tabulate (within an ods tagsets.excelxp output):

ods tagsets.excelxp path="C:\Tables" file="table1.xml";

ods tagsets.excelxp options (sheet_interval="table");

ods tagsets.excelxp options (sheet_name="table 1");

     proc tabulate data=sashelp.class;

     CLASS age sex height weight;

     TABLE  age,sex*(n=''*F=9.)/rts=40;

     TABLE  height,sex*(n=''*F=9.)/rts=40;

     TABLE  weight,sex*(n=''*F=9.)/rts=40;

     run;

ods tagsets.excelxp options (sheet_name="table 2");

     proc tabulate data=sashelp.class;

     where age=15;

     CLASS age sex height weight;

     TABLE  age,sex*(n=''*F=9.)/rts=40;

     TABLE  height,sex*(n=''*F=9.)/rts=40;

     TABLE  weight,sex*(n=''*F=9.)/rts=40;

     run;

ods _all_ close;

By default sas names the sheets of the first proc: table 1 , table 1 2, table 1 3 and the sheets of the second proc: table 2, table 2 2, table 2 3.

I'd like, instead: table 1.1 , table 1.2, table 1.3 and table 2.1 , table 2.2, table 2.3.

So it should begin from number 1 in the first sheet (instead of writing nothing) and  it should put "." instead of the space between the name and the counter.

Thanks again,

Daniela

Cynthia_sas
Diamond | Level 26

Hi:

  I am not sure you can get ODS to use a '.' instead of a space, but you can use the sheet_name and sheet_label suboptions to have some control over the table. Switching your code to SAS Macro might be one approach. I am not sure whether you can change the tagset template for ExcelXP to alter the way it makes sheet names or not. That would be a question for Tech Support.

cynthia

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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