Date: Tue, 19 Aug 2008 13:10:37 -0500
Reply-To: Mary <mlhoward@avalon.net>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Re: exporting datainto excel sheet into different tabs
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
You can do this with Excel Tagsets, each time you want a new sheet issue a
command like this with a new sheet name:
ods tagsets.excelxp options(sheet_name='age65to84_nonsmoking');
Here is code that takes a dataset and writes each section it to a different
sheet based on the by variable "sheetname".
%macro do_calls;
ods listing close;
ods tagsets.excelxp file='C:\Work_Activities\results_sheetnames.xls'
style=analysis
options(absolute_column_width='15,10,8,8,8,8,8,8,8,8,8,8,8,8'
sheet_label=' ');
proc sql;
create table bylist as
select distinct sheetname
from results_all;
quit;
run;
data bylist;
set bylist;
obsnum + 1;
run;
proc sql noprint;
select count(*) into :model_count
from bylist;
quit;
%put &model_count;
%Do I = 1 %To &model_count;
proc sql noprint;
select sheetname into :sheetname
from bylist
where obsnum =&i;
quit;
ods tagsets.excelxp options(sheet_name="&sheetname");
data results;
set results_all;
if sheetname= "&sheetname";
drop sheetname;
proc print noobs data=results;
run;
%End ;
ods tagsets.excelxp close;
ods listing;
%mend;
%do_calls;
-Mary
----- Original Message -----
From: chittiprolu pradeep
To: SAS-L@LISTSERV.UGA.EDU
Sent: Tuesday, August 19, 2008 12:01 PM
Subject: exporting datainto excel sheet into different tabs
Hi All,
Can any one tell me how can I export data into excel file into different
tabs.
i.e., I have seven datasets and I want to export these datasets into
excel sheet. Same excel sheet into different tabs.
And also is there any way of changing the fonts, colours features
through sas in exell sheet ?
Thanks for all your help,
CHP