|
On Thu, 18 Nov 2004 11:12:12 -0500, L. Sheng <lhsheng_1@YAHOO.COM> wrote:
>I want to import the 4 sheets in one excel file to SAS. How can I do it
>to create 4 sas data sets corresponding to each sheet in that excel file?
>
>Thank you.
Hi, L,
If you have ms office 2002 (aka office xp) or later with sas 9 or later,
then the simplest way is to ods out the office xml file and let the excel
deal with converting xml into work sheets.
Recently at NESUG2004, Vicent DelGobbo (si), presented a paper doing
exactly this. The paper is available at:
http://www.nesug.org/html/Proceedings/nesug04/io/io10.pdf
and here is my test code to create two worksheets in a file. Each proc
print output goes to one sheet. The generated excel workbook can be seen
at http://changchung.com/g/test_ExcelXP.xls .
HTH.
Cheers,
Chang
<sasl:code sysver="9.1" sysscp="WIN">
%let pwd=%sysfunc(pathname(WORK));
%put NOTE: pwd=&pwd.;
x cd "&pwd.";
ods listing close; /* close the listing destination, i.e. lst output */
ods results off; /* turn off the results window */
ods tagsets.excelXP file="test_ExcelXP.xls" path="&pwd.";
proc print data=sashelp.class; /* first sheet */
run;
proc print data=sashelp.class; /* second sheet */
run;
ods tagsets.excelXP close;
ods results on;
ods listing;
</sasl:code>
|