DATA Step, Macro, Functions and more

Importing a .xlsx file into SAS

Reply
Contributor
Posts: 50

Importing a .xlsx file into SAS

hi,

i am getting an error while importing a excel file into sas.i am using portable version sas .

this is my code:

proc import datafile="C:\Analytixlabs1\5 - Data Exploration (SAS Module 2)\Grocery_coupons.xls"
out=Grocery_coupons dbms=Excel
Replace;
Sheet="Data";
getnames=yes;
datarow=2;
run;

 

i am getting an error: Statement is not valid or it is used out of proper order.????????

please help

Super User
Super User
Posts: 7,401

Re: Importing a .xlsx file into SAS

Hi,

 

Please clarify what software you are using, there is no such thing as portable SAS.  Also, post your log including the statements before the problem area.

Contributor
Posts: 50

Re: Importing a .xlsx file into SAS

Hi,

i am using SAS system 9.0 portable version.

what should i do ??

is there any other way to import excel file into sas?

 

 

Super User
Super User
Posts: 7,401

Re: Importing a .xlsx file into SAS

You haven't answered either of my questions.  There is no such thing as portable SAS, what are you using, how is is setup?  Are you using University Edition, or Enterprise Guide etc.  You haven't posted the log of what is happening before that statement either.

Super User
Posts: 6,938

Re: Importing a .xlsx file into SAS

Define "portable".

And SAS 9.0 is way beyond old. The oldest SAS version reasonably used is 9.2.

AND POST YOUR LOG!!!!!

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 18

Re: Importing a .xlsx file into SAS

One thing to try is to use the right extension:

 

proc import datafile="C:\Analytixlabs1\5 - Data Exploration (SAS Module 2)\Grocery_coupons.xlsx"

Occasional Contributor
Posts: 18

Re: Importing a .xlsx file into SAS

I would try changing the file to a .csv instead of a .xlsx file since SAS may have problems reading in an Excel file with any verison prior to SAS 9.2.

Super User
Posts: 9,681

Re: Importing a .xlsx file into SAS

"datarow=2;" is not supported by engine Excel, remove it .

Ask a Question
Discussion stats
  • 7 replies
  • 369 views
  • 0 likes
  • 5 in conversation