Desktop productivity for business analysts and programmers

getting problem with PROC IMPORT

Reply
N/A
Posts: 0

getting problem with PROC IMPORT

Hi i am using proc import to upload data from excel to sas . I got 4 seets to upload I used this code
.proc

import out=bible

datafile='C:\Documents and Settings\calapati\Desktop\European Specialisation_Cert Data-Sept07.xls'


DBMS=Excel replace;
sheet= Microsoft Excel Worksheet;

getnames=yes;

mixed=yes;

scantext=yes;

usedate=yes;

scantime=yes;

run;
but i can able to upload only one sheet . WHY I AM NOT ABLE TO UPLOAD OTHER FILE . CAN ANY ONE CAN LET ME KNOW WHAT I DID MISTAKE

THANKS
CHANDRA
SAS Super FREQ
Posts: 8,814

Re: getting problem with PROC IMPORT

Hi:
The WORKBOOK is what you specify on the DATAFILE= option. Each sheet within the WORKBOOK must be specified with the Sheet name option. You can only specify 1 worksheet per PROC IMPORT step. If you specify 2 SHEET= options, the last SHEET= option will be the sheet used for the IMPORT.

Perhaps these Tech Support notes and user papers will help:

http://support.sas.com/kb/6/988.html
http://support.sas.com/kb/6/353.html

If you want to put ALL the sheets into 1 SAS dataset, one approach is to create a temp file for each sheet and then bring all together in a separate step.

Or, as described in one of the above notes, you could use a SAS Macro program to import multiple worksheets using PROC IMPORT or DATA step code.

Or, you could use the SAS Excel Libname engine (with SAS 9 and SAS/Access to PC File Formats):
[pre]
libname mywb "c:\temp\threesheet.xls";

data new;
set mywb.'names1$'n
mywb.'names2$'n
mywb.'names3$'n;
run;

proc print data=new;
run;

[/pre]

would import all 3 sheets into WORK.NEW using the SAS/Excel Libname engine.
cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 115 views
  • 0 likes
  • 2 in conversation