BookmarkSubscribeRSS Feed
shru
Calcite | Level 5

Hi,

I have a excel sheet with four worksheets.

How can i achieve importing this using proc import

I tried giving as

'sheet $'n

but i did not work

and also i need to make one cell in the imported excel sheet as dynamic,so that when i run the macro the value needs to get updated

Help me in this..

2 REPLIES 2
Hima
Obsidian | Level 7

PROC IMPORT OUT= TEST
            DATAFILE= "C:\Documents and Settings\Test.xls"
            DBMS=excel REPLACE;
   SHEET="Sheet1";
RUN;

PROC IMPORT OUT= TEST1
            DATAFILE= "C:\Documents and Settings\Test.xls"
            DBMS=excel REPLACE;
   SHEET="Sheet2";
RUN;

Log:

32 PROC IMPORT OUT= TEST

33 DATAFILE= "C:\Documents and Settings\nbk8gia\My Documents\My SAS

33 ! Files\Test.xls"

34 DBMS=excel REPLACE;

35 SHEET="Sheet1";

36 RUN;

NOTE: WORK.TEST data set was successfully created.

NOTE: PROCEDURE IMPORT used (Total process time):

real time 3.06 seconds

cpu time 0.79 seconds

37

38 PROC IMPORT OUT= TEST1

39 DATAFILE= "C:\Documents and Settings\nbk8gia\My Documents\My SAS

39 ! Files\Test.xls"

40 DBMS=excel REPLACE;

41 SHEET="Sheet2";

42 RUN;

NOTE: WORK.TEST1 data set was successfully created.

NOTE: PROCEDURE IMPORT used (Total process time):

real time 3.18 seconds

cpu time 0.84 seconds

Cynthia_sas
SAS Super FREQ

Hi:

  It seems unlikely that this is an ODS question. PROC IMPORT is NOT one of the SAS Reporting procedures and, in addition, PROC IMPORT does NOT use ODS at all in the import process.

  Your best bet for help would be to post your question to either the SAS PROCEDURES forum (http://communities.sas.com/community/sas_procedures) or the SAS Macro forum (since you mentioned making something dynamic) -- (http://communities.sas.com/community/sas_macro_facility_data_step_and_sas_language_elements) since it is generally a macro program that makes programs more dynamic.

  It would also be useful if you posted your PROC IMPORT code and described where or how you need to have the program create variables dynamically.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 939 views
  • 0 likes
  • 3 in conversation