« Highlighted ELUG Member - Vincent Danen | Main | An alternative SAS editor »

Convert Excel to SAS Dataset

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;

Posted on Tuesday, April 1, 2008 by Registered CommenterJared in | CommentsPost a Comment

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>