|
From: John Hixon
<robert.schechter@ASTRAZENECA.COM> wrote
>Hi Gang,
>I thought I remember this came up before, but I have searched the archives
>without success.
>I need to write an Excel spreadsheet and have the column headers be
created
>from the SAS variable labels. I'm using SAS version 8.
>TIA,
Robert,
You've recvd good suggestions already. Assuming you don't need to
customize
your Excel cells using DDE, here is a "quick and dirty" way to output
to Excel.
* make dummy data, some with labels;
data junk;
array v{10};
input v1-v10;
do j=1 to 25;
do k=1 to 10;
v(k)=j*v(k);
end;
output;
end;
label v1="Yadda One"
v2="Yadda Two"
v3="Yadda 3"
v4="Yadda 4"
v5="Yadda 5";
datalines;
1 2 3 4 5 6 7 8 9 10
;
run;
*output directly to xls file. This will start Excel right away (which
can be annoying.) Another option is to write to an html file, then
open it using Excel;
* this will make an excel sheet using variable names as headers;
ods html file='c:\temp\JunkNolabels.xls' style=SASweb;
proc print data=junk;
run;
* this will make an excel sheet using variable labels as headers;
ods html file='c:\temp\JunkWithlabels.xls' style=SASweb;
proc print data=junk label;
run;
ods html close;
*HTH;
Best Regards,
John Hixon
Eastman Kodak Company
Rochester, NY USA
|