Help using Base SAS procedures

proc import

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

proc import


Hello,

I would like to import an excel file in sas (the estension of my file is .xlsx), but i don't know how to do it?

I would like to code it instead to use "file--> import data-->...".

I tried to use the procedure import but i don't get it.

Thanks.

Anaïs


Accepted Solutions
Solution
‎09-06-2012 06:51 AM
Super Contributor
Posts: 349

Re: proc import

Hi,

Try this..

PROC IMPORT OUT= WORK.input

            DATAFILE= "F:\test.xlsx"

            DBMS=EXCEL REPLACE;

     RANGE="Sheet$";

     GETNAMES=YES;

     MIXED=NO;

     SCANTEXT=YES;

     USEDATE=YES;

     SCANTIME=YES;

RUN;

Thanks,

Shiva

View solution in original post


All Replies
Solution
‎09-06-2012 06:51 AM
Super Contributor
Posts: 349

Re: proc import

Hi,

Try this..

PROC IMPORT OUT= WORK.input

            DATAFILE= "F:\test.xlsx"

            DBMS=EXCEL REPLACE;

     RANGE="Sheet$";

     GETNAMES=YES;

     MIXED=NO;

     SCANTEXT=YES;

     USEDATE=YES;

     SCANTIME=YES;

RUN;

Thanks,

Shiva

Occasional Contributor
Posts: 12

Re: proc import

Thanks a lot Shiva.

I tried your codes, and I successfully get the excel file in the sas program!

Thanks,

Anaïs

Super Contributor
Posts: 358

Re: proc import

Hi:

You know that if you use "file ---> import data ---> etc", you can save the code that was generated to load the file into SAS?

Then you just INCLUDE that code into you SAS session and save it - save you having to write the code in the first place.

Occasional Contributor
Posts: 12

Re: proc import

thanks for the information. I ignored that i could save the code when i used "file--> import data..".

Can-you explain me how to save the code generated to load the file into sas?

Thanks a lot,

Anaïs

New Contributor Li
New Contributor
Posts: 3

Re: proc import

Does this code works under SAS 9.3 Win7 64x machine? - Thanks. Li

Occasional Contributor
Posts: 12

Re: proc import

I don't know if it work under sas 9.3 Win7 64x machine.

I used the codes mentioned above on sas 9.3  32bit;

Anaïs

New Contributor Li
New Contributor
Posts: 3

Re: proc import

No, this will not work. I just tried. The log is:

ERROR: Connect: Class not registered

ERROR: Error in the LIBNAME statement.

PROC Star
Posts: 7,363

Re: proc import

SAS Employee
Posts: 10

Re: proc import

Hi Anais,

Sounds like you tried to use the documentation for PROC IMPORT but you "didn't get it."  I assume you were using the SAS/ACCESS Interface to PC Files, right?  

If you have feedback about the documentation that would help us improve it, please let me know.  Also, for the .xlsx format, there are a number of SAS Notes; just search on xlsx and import to see them.  Thanks,

Susan

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 555 views
  • 0 likes
  • 6 in conversation