The SAS Output Delivery System and reporting techniques

ODS excel & multiple sheets

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

ODS excel & multiple sheets

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;


Accepted Solutions
Solution
‎12-15-2016 09:00 PM
SAS Super FREQ
Posts: 8,646

Re: ODS excel & multiple sheets

[ Edited ]

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

mult_names.png

View solution in original post


All Replies
Frequent Contributor
Posts: 96

Re: ODS excel & multiple sheets

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:

http://support.sas.com/documentation/cdl/en/odsug/69832/HTML/default/viewer.htm#p09n5pw9ol0897n1qe04...

 

Contributor
Posts: 66

Re: ODS excel & multiple sheets

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".

 

 

Frequent Contributor
Posts: 96

Re: ODS excel & multiple sheets

Can you provide the code,

which you have submitted ?

 

Solution
‎12-15-2016 09:00 PM
SAS Super FREQ
Posts: 8,646

Re: ODS excel & multiple sheets

[ Edited ]

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

mult_names.png

New Contributor
Posts: 3

Re: ODS excel & multiple sheets

ods excel file="YOURS.xlsx" 
   options(sheet_label="Column" );
Post a Question
Discussion Stats
  • 5 replies
  • 326 views
  • 0 likes
  • 4 in conversation