DATA Step, Macro, Functions and more

how can i import excel file in sas from second row?

Reply
Contributor
Posts: 20

how can i import excel file in sas from second row?

I want o import file from second row but it is throwing out error. Below mentioned is the statement that i have executed.Please find the attachement for error formed.

 

Statement Executed:

 

proc import datafile="C:\Documents\execrise2\Database.xls"

out= work.a

DBMS=EXCEL REPLACE;

SHEET="Gold$";

GETNAMES=NO;

DATAROW=2;

RUN;

 

 

 

 


error1.PNG
Super User
Posts: 3,114

Re: how can i import excel file in sas from second row?

Your error message refers to the DELIMITER =  option which is not in your posted code. Also DATAROW is not available with DBMS = EXCEL, try DBMS = XLS instead:

 

http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0msy4hy1so0ren1ac...

 

Contributor
Posts: 20

Re: how can i import excel file in sas from second row?

Still its not working

 

Super User
Posts: 3,114

Re: how can i import excel file in sas from second row?

Post your SAS log then.

Super User
Posts: 6,963

Re: how can i import excel file in sas from second row?

[ Edited ]

Get rid of the crappy Excel file format. Export to something sensible and text-based (CSV!!) from Excel, and read that into SAS.

Excel files only cause problems.

 

Why?

With Excel, you always force SAS to make guesses about column attributes and the size of the data (no of rows and columns) for you.

With a text file and a data step, you control the import process.

 

Run the system, don't let the system run you.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 20

Re: how can i import excel file in sas from second row?

i totally accept but now a days i am doing exercises based on these concept so i am eager to know the solution.
Super User
Posts: 10,538

Re: how can i import excel file in sas from second row?

Please post the log of the code you ran along with any error messages.

 

If there is not an error the describe exactly how it is not working. Is there no data in the result? Incomplete data? Unexpected data? Provide details of exactly what is unsatisfactory.

 

Note that providing the Excel file may not help as Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software.

Ask a Question
Discussion stats
  • 6 replies
  • 243 views
  • 0 likes
  • 4 in conversation