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
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
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
Thanks a lot Shiva.
I tried your codes, and I successfully get the excel file in the sas program!
Thanks,
Anaïs
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.
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
Does this code works under SAS 9.3 Win7 64x machine? - Thanks. Li
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
No, this will not work. I just tried. The log is:
ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
Li: take a look at: http://support.sas.com/kb/37/412.html
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
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.