| Date: | Thu, 21 Aug 2008 07:31:57 +0100 |
| Reply-To: | cherish k <hawks_cherish@YAHOO.CO.IN> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | cherish k <hawks_cherish@YAHOO.CO.IN> |
| Subject: | Re: problem exporting results to excel |
|
| In-Reply-To: | <00d301c902cd$f186bbe0$832fa8c0@HP82083701405> |
| Content-Type: | text/plain; charset=utf-8 |
Excel Tagsets works perfect. It retains all the formats and functions are also working well.
Thanks a lot.
Cherish
Mary <mlhoward@avalon.net> wrote: Have you considered using Excel tagsets rather than html? This produces an XML file, but it can be pulled into Excel and does retain the formatting well. Here is an example:
%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: cherish k
To: SAS-L@LISTSERV.UGA.EDU
Sent: Wednesday, August 20, 2008 2:00 AM
Subject: problem exporting results to excel
Hi All,
When i try to export the results from SAS dataset to excel sheet, formats get changed. For example if in SAS, Mobile number is 0238644859 (which is in text $10 format), when i export it to excel it changes to numeric and the first zero gets eliminated. Can somebody guide me on how to retain the formats while exporting it to Excel. I use the following code to export it to excel.
ods html body = "C:\Documents and Settings\cherish\My Documents\Cherish\Data_Analysis\Results\Print_Results.xls" style = minimal;
proc print data = dataset;
run;
ods html close;
Regards,
Cherish
---------------------------------
Unlimited freedom, unlimited storage. Get it now
---------------------------------
Connect with friends all over the world. Get Yahoo! India Messenger.
|