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?
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:
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 .
<sasl:code sysver="9.1" sysscp="WIN">
%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 */
proc print data=sashelp.class; /* second sheet */
ods tagsets.excelXP close;
ods results on;