BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
1 REPLY 1
Cynthia_sas
Diamond | Level 26
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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 897 views
  • 0 likes
  • 2 in conversation