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!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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