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
SAS Super FREQ
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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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