BookmarkSubscribeRSS Feed
rk_sasanalyst
Calcite | Level 5

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.

 

5 REPLIES 5
Reeza
Super User

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. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Cynthia_sas
SAS Super FREQ

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;
Cynthia_sas
SAS Super FREQ

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

rk_sasanalyst
Calcite | Level 5

Thank you Cynthia.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1252 views
  • 0 likes
  • 4 in conversation