Hi all,
I have a sample code list below. Is there a way to name the different tabs after getting the Tabulate tables? Thanks.
ods excel file="Pathway\Dataout_Sites_&tdate..xlsx";
proc tabulate data=Datain1;
var Total_Cost;
class class;
table class*N;
format class class.;
where class in (5,6,7,8);
run;
proc tabulate data=Datain2;
var Lab Radiology Diagnostic_Other;
class Patient_class;
table Patient_class * N;
format Patient_class Patient_class.;
run;
proc tabulate data=Datain3;
var n;
class patient_class;
table patient_class*n*(mean median);
format patient_clas patient_class.;
run;
ods excel close;
ods excel file="Pathway\Dataout_Sites_&tdate..xlsx" options(sheet_name="DataIn1");
proc tabulate data=Datain1;
var Total_Cost;
class class;
table class*N;
format class class.;
where class in (5,6,7,8);
run;
ods excel options(sheet_name="DataIn2");
proc tabulate data=Datain2;
var Lab Radiology Diagnostic_Other;
class Patient_class;
table Patient_class * N;
format Patient_class Patient_class.;
run;
ods excel options(sheet_name="DataIn3");
proc tabulate data=Datain3;
var n;
class patient_class;
table patient_class*n*(mean median);
format patient_clas patient_class.;
run;
ods excel close;
Feel free to use any valid sheet names you want.
ods excel file="Pathway\Dataout_Sites_&tdate..xlsx" options(sheet_name="DataIn1");
proc tabulate data=Datain1;
var Total_Cost;
class class;
table class*N;
format class class.;
where class in (5,6,7,8);
run;
ods excel options(sheet_name="DataIn2");
proc tabulate data=Datain2;
var Lab Radiology Diagnostic_Other;
class Patient_class;
table Patient_class * N;
format Patient_class Patient_class.;
run;
ods excel options(sheet_name="DataIn3");
proc tabulate data=Datain3;
var n;
class patient_class;
table patient_class*n*(mean median);
format patient_clas patient_class.;
run;
ods excel close;
Feel free to use any valid sheet names you want.
So, like adding the sheet name in order as below?
ods excel file="Pathway\Dataout_Sites_&tdate..xlsx" options(sheet_name="DataIn1" sheet_name="DataIn2" sheet_name="DataIn3");
That's not the code I provided. The code I provided should work without modification, if your PROC TABULATE blocks are correct.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.