BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Konkordanz
Pyrite | Level 9

hi,

 

I want to export two proc-report-outputs into two excel-sheets. But I want to give them specific names. Is this within the single proc-report-steps doable (maybe with an "out="-command)? Or do I always have to write a base-name into the options-part?

For example: With following Code the names of the excel-sheets are DB and DB 2. What I want is for example Result_XY and City_Z.

 

Thank you!

ODS excel file="XY"
options(sheet_name="DB");

proc report data=test;
column LF_Typ16 HRF_P_SN (GGKL_akt6,HRF_P_SN) (HRF_P_SN,n) GGKL_akt6;
define LF_Typ16 / group;
define HRF_P_SN / analysis;
define GGKL_akt6 / across;
where Bev_LF='01_LF_HW' and LF_StiLF=1;
run;

proc report data=test;
column LF_Typ16 HRF_P_SN (GGKL_akt6,HRF_P_SN) (HRF_P_SN,n) GGKL_akt6;
define LF_Typ16 / group;
define HRF_P_SN / analysis;
define GGKL_akt6 / across;
where Bev_LF='01_LF_HW' and LF_StiLF=1;
run;

ods excel close;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
ODS excel file="XY.xlsx" options(sheet_name="Result XY");

proc report data=test;
column LF_Typ16 HRF_P_SN (GGKL_akt6,HRF_P_SN) (HRF_P_SN,n) GGKL_akt6;
define LF_Typ16 / group;
define HRF_P_SN / analysis;
define GGKL_akt6 / across;
where Bev_LF='01_LF_HW' and LF_StiLF=1;
run;

ods excel options(sheet_name='City Z');
proc report data=test;
column LF_Typ16 HRF_P_SN (GGKL_akt6,HRF_P_SN) (HRF_P_SN,n) GGKL_akt6;
define LF_Typ16 / group;
define HRF_P_SN / analysis;
define GGKL_akt6 / across;
where Bev_LF='01_LF_HW' and LF_StiLF=1;
run;

ods excel close;

 

As a minor side note ... why do you want sheet names with underscores in the name? I think (again this is minor) that Result XY looks more readable and professional than Result_XY.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
ODS excel file="XY.xlsx" options(sheet_name="Result XY");

proc report data=test;
column LF_Typ16 HRF_P_SN (GGKL_akt6,HRF_P_SN) (HRF_P_SN,n) GGKL_akt6;
define LF_Typ16 / group;
define HRF_P_SN / analysis;
define GGKL_akt6 / across;
where Bev_LF='01_LF_HW' and LF_StiLF=1;
run;

ods excel options(sheet_name='City Z');
proc report data=test;
column LF_Typ16 HRF_P_SN (GGKL_akt6,HRF_P_SN) (HRF_P_SN,n) GGKL_akt6;
define LF_Typ16 / group;
define HRF_P_SN / analysis;
define GGKL_akt6 / across;
where Bev_LF='01_LF_HW' and LF_StiLF=1;
run;

ods excel close;

 

As a minor side note ... why do you want sheet names with underscores in the name? I think (again this is minor) that Result XY looks more readable and professional than Result_XY.

--
Paige Miller
Konkordanz
Pyrite | Level 9

Perfect, thx for it!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 1056 views
  • 1 like
  • 2 in conversation