BookmarkSubscribeRSS Feed
YangYY
Quartz | Level 8

I am asked to use set statement to concatenate the data of the 3 execl sheets into a SAS data set. And use INDSNAME option in SET statement to record which data is from which worksheet.

But I don't know how. My data has been uploaded.  Anyone could help?

 

Thank you!!

 

4 REPLIES 4
SASKiwi
PROC Star

Something like this should do it:

 

libname oil excel "oil_countries.xlsx";

data oil;
  set oil.oil_production
      oil.oil_consumption
      oil.oil_reserves
      indsname = sheet_name
     ;
run;
YangYY
Quartz | Level 8

Thank you for your reply!

 

But the log file shows error.

My code is

libname assign03 excel "oil_countries.xlsx";

data oil;
set assign03.oil_production
assign03.oil_consumption
assign03.oil_reserves
indsname = sheet_name
;
run;

 

Log says

70
71 libname assign03 excel "oil_countries.xlsx";
ERROR: The EXCEL engine cannot be found.
ERROR: Error in the LIBNAME statement.
72
73 data oil;
74 set assign03.oil_production
75 assign03.oil_consumption
76 assign03.oil_reserves
77 indsname = sheet_name
78 ;
ERROR: Libref ASSIGN03 is not assigned.
ERROR: Libref ASSIGN03 is not assigned.
ERROR: Libref ASSIGN03 is not assigned.
79 run;
 
SASKiwi
PROC Star

@YangYY  - Check to see if SAS/ACCESS to PC Files is installed and licensed:

proc product_status;
run;

proc setinit;
run;
Tom
Super User Tom
Super User

The EXCEL engine will only work if you are running on WIndows.

Try the XLSX engine instead.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 545 views
  • 0 likes
  • 3 in conversation