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!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.