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;
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.
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.
Perfect, thx for it!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.