Convert Excel to SAS Dataset
Tuesday, April 1, 2008
Jared in SAS

Here is the code I use to pull an Excel Worksheet into a SAS Dataset:

PROC IMPORT DATAFILE="C:\folder\project\file.xls"
OUT=mydata
DBMS=excel2002 REPLACE;
SHEET="MySheetName";
GETNAMES=yes;     * variable names are in row 1 ;
RANGE="MySheetName$A1:P2582"; * omit if you want to read the entire worksheet;
MIXED=YES; * V. 9: converts numerical values mixed in with character data into a variable with all character values;
SCANTEXT=yes;   * V. 9 only;
USEDATE=no;    * V. 9 only - read with date format only (note date-time);
SCANTIME=no;    * V. 9 only;
DBSASLABEL= none; * V. 9 only;
RUN;

Article originally appeared on jaredprins (http://jaredprins.squarespace.com/).
See website for complete article licensing information.