Below is my code, I want to get a excel files with multiple sheets. My question is how I can specify each sheet name. For example: sheet 1 is named Report, sheet2 is named RESULT, and sheet 3 is named FINDING.
data a;
length PatientID $2;
input PatientID $ Systolic Diastolic @@;
datalines;
CK 120 50 SS 96 60 FR 100 70
CP 120 75 BL 140 90 ES 120 70
;
data b;
length PatientID $2;
input PatientID $ Systolic Diastolic @@;
datalines;
CP 165 110 JI 110 40 MC 119 66
FC 125 76 RW 133 60 KD 108 54
DS 110 50 JW 130 80 BH 120 65
;
data c;
length PatientID $2;
input PatientID $ Systolic Diastolic @@;
datalines;
CP 120 75 BL 140 90 ES 120 70
CP 165 110 JI 110 40 MC 119 66
FC 125 76 RW 133 60 KD 108 54
DS 110 50 JW 130 80 BH 120 65
;
ods excel file="path\aaa.xlsx";
proc report data=a;
column _all_;
run;
proc report data=b;
column _all_;
run;
proc report data=c;
column _all_;
run;
ods excel close;
My suggestion would be to use the sheet_name option instead of the sheet_label option.
See the attached example. It doesn't matter whether you use PROC PRINT or PROC REPORT or PROC ... Sheet_name will change the sheet_name.
cynthia
ods excel file="name.xlsx" options(sheet_label="country" );
try to use this option,
it will create an sheet with the name which you have mentioned.
for more info please refer this link:
When I run the code I got the sheet names as following:
"country - Detailed and-or su 1"
"country - Detailed and-or su 2"
"country - Detailed and-or su 3".
This is not what I want.
I want differnt sheet names such as "Report", "Result", "Finding".
Can you provide the code,
which you have submitted ?
My suggestion would be to use the sheet_name option instead of the sheet_label option.
See the attached example. It doesn't matter whether you use PROC PRINT or PROC REPORT or PROC ... Sheet_name will change the sheet_name.
cynthia
Awesome! Thanks Cynthia.
ods excel file="YOURS.xlsx" options(sheet_label="Column" );
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!
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.