SAS 9.1.3 allows you to read Excel worksheets directly rather than entering
PROC IMPORT commands. Data must be formatted in a consistent manner down
columns with variable names in the first row. In the example below, SAS identifies
a worksheet named Sheet1 as the literal name 'Sheet1$'n.
The following DATA step reads two worksheets with an identical file structure from one workbook and appends them into a single SAS dataset called sas_data:
LIBNAME exbk excel 'c:\your_file.xls' ver=2000;
DATA sas_data;
SET exbk.'Sheet1$'n exbk.'Sheet2$'n;
RUN;
LIBNAME exbk clear;
With the second LIBNAME statement, SAS releases control over the Excel workbook, allowing you to access it once again from Excel. Data may also be written to an Excel file with the DATA step:
DATA exbk.pred;
SET predicted;
RUN;
The two LIBNAME statements above need to be entered and the worksheet is named 'pred.' However, the Excel file must not already exist, since this approach does not include the REPLACE option
Prospective UO users of SAS/PC should note that it requires XP Professional rather than the XP Home edition of the Windows operating system. (Note: SAS/PC will run on other PC operating systems, such as Windows 2000, but XP users who wish to install SAS must run XP Professional.)