BookmarkSubscribeRSS Feed
dkanand86
Calcite | Level 5

Hi Everyone,

Please can you suggest 4-5 ways of importing excel file into SAS 9.3

Note:

1. When i use proc import, SAS gives error related invalid dbms= option.

Please help.

Thanks

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Note: - Use a valid dbms option?  I.e. do you have SAS Access installed, are you using the correct dbms for you file type, here is the list of them:

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

That aside, I wouldn't recommend using:

a) Excel - this is not a good data transfer format.  Use CSV, XML or any of the other proper structured data transfer formats

b) Proc import/export - these are guessing procedures.  They guess what data you want to import.  Use a proper data transfer format and write and explicit datastep import to import the data as you know it to be.

Options:

1) Datastep infile and inputs with CSV file.  Most robust method.

2) libname xml

3) libname excel - limited to accessible data

4) proc import - guesswork

Ksharp
Super User

1) proc import

2) libname

3) ODBC

4) DDE <-- old school

5) filename + clipboard

dkanand86
Calcite | Level 5


Please can you provide the exact code for importing using datastep and importing using proc import.

I will definitely look into the list of dbms types from the link you provided.

Tom
Super User Tom
Super User

If you have to do it use XLSX file format and DBMS=XLSX.

To just get the first sheet use:

proc import file='myfile.xlsx' out=MYSAS dbms=xlsx;

run;

dkanand86
Calcite | Level 5

my SAS shows, it is dbms= type is INVALID.

Tom
Super User Tom
Super User

Upgrade.  Smiley Happy

Try changing to XLS and see if it works.

Other trick from the bad old days was to use

SHEET="'A B'$"

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!

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
  • 6 replies
  • 1910 views
  • 0 likes
  • 4 in conversation