The SAS Output Delivery System and reporting techniques

Display All BY groups in same ODS EXCEL

Reply
New Contributor
Posts: 4

Display All BY groups in same ODS EXCEL

[ Edited ]

Hi,

 

I want to print all BY groups in single ODS EXCEL sheet. But here each BY group should differentiate with  'Title' on same page.

Example: In sashelp.class, SEX='M' and 'F'. So, both 2 groups should print on the same ODS.excel sheet.

 

I am using ODS tagsets.excelXP options(sheet_name=);

 

I am trying to create a macro on this.

 

Thanks.

 

Grand Advisor
Posts: 16,393

Re: Display All BY groups in same ODS EXCEL

Your post is confusing. Are you using ODS EXCEL or Tagsets.ExcelXP

 

How/Where do macros come in? 

 

If tagsets are being used, set sheet_imterval='none' and use PROC REPORT/PRINT to display your data as desired. 

Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: Display All BY groups in same ODS EXCEL

Why are you trying to create a macro when you don't even seem to know what yuo want to do?  This is the number 1 reason why 99% of macros are a total waste of disk space and get deleted as soon as I see them.  If your developing code for use across programs, departements, comapnies even, then you should be following the principals of software development lifecycle.  Firstly you would create your functional design specification which woud detail purpose, inputs, outputs, testing etc.  In this document you would detail requirements, such as whether or not to use ods.excel technology, or ods tagsets technology.

 

To answer you other question, if you are using tagsets.excelxp then then quick reference sheet really helps:
https://support.sas.com/rnd/base/ods/odsmarkup/excelxp_help.html

Look at embedded_titles, and sheet_interval="none" options.

SAS Super FREQ
Posts: 8,645

Re: Display All BY groups in same ODS EXCEL

Hi:

  I would recommend trying something like this code before you try using macro code. Sheet_interval='none' was designed to do what you describe (putting multiple outputs like BY groups in one sheet).

cynthia

ods tagsets.excelxp file="c:\temp\bygroup_one_sheet.xml" 
    options(sheet_interval='none');
    
    proc print data=sashelp.class; by age;
      where age in (12, 13, 14);
    run;
ods tagsets.excelxp close;
SAS Super FREQ
Posts: 8,645

Re: Display All BY groups in same ODS EXCEL

Hi:

  It seems you posted a similar question in a different forum. I posted an updated version of this program over in that location

https://communities.sas.com/t5/Integration-with-Microsoft/ODS-tagsets-ExcelXP-control-SheetName-of-e...

 

  But, I am also posting the screen shot here.

 

cynthiabyval_age.png

New Contributor
Posts: 4

Re: Display All BY groups in same ODS EXCEL

Thank you Cynthia.

Post a Question
Discussion Stats
  • 5 replies
  • 220 views
  • 0 likes
  • 4 in conversation