Like anandbillava, I was having the same problem. I am unable to get SAS Access to PC File Formats to read a DBMS of Excel in UNIX.
First off, thanks for the original post and also the responses. It helped me find my solution for SAS 9.13 SP4 on AIX. (SAS 9.2 looks a lot better.)
I uploaded the following binary Excel file via FTP.
x | y |
a | 2 |
b | 3 |
c | 4 |
d | 5 |
e | 6 |
f | 7 |
PROC IMPORT OUT= WORK.pctounix
DATAFILE= "a unix file.xls"
DBMS=EXCEL REPLACE; /* couldn't get this dbms to work */
SHEET="Sheet1$"; /* SAS 9.13 doesn't support Sheets */
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
Code that worked...
PROC IMPORT OUT= WORK.pctounix
DATAFILE= "a unix file.xls"
DBMS=XLS REPLACE;
GETNAMES=YES;
MIXED=NO;
RUN;
If anyone is doing this with SAMBA (or similar product) and bypassing the FTP, please share your experience.
Other Useful papers and notes...
http://support.sas.com/kb/16/812.html
http://support.sas.com/resources/papers/proceedings09/139-2009.pdf
Kim LeBouton
Kim
on unix SAS has module SAS/Access to PC files
It still does not support the sophistication of the windows excel libname engine
libname libref excel 'excel workbook' ;
which "cans the import routines" to provide access to all objects in the workbook, like "SHEET1$"n and (my preference) ranges named like sas tables
it is very awkward to handle excel in unix.
With enterprise guide connected to SAS on unix, reading from excel became an "interactive" task because guide performed the data transfer from the windows environment to a csv-type file in unix for each sheet or range that I had to read.
maybe I just couldn't read the right manuals
best of luck
Peter
These issues are not isolated to SAS on unix. It is more a issue of SAS in a 64bit enviornment vs. a 32bit enviornment. DBMS=excel is a 32 bit engine as well as most of the other similar. XLS and EXCELCS are the 64bit engines. They have less functionality and compatibility that the 32bit engines. The module SAS/Access for PC Files that Peter mentions comes into play when either using the EXCELCS engine or the libname pcfiles engine. It requires you to have a pc files server running on a windows machine is utilzing unix, I beleive. Other options for accessing excel files are through the DDE components but I have never used these tools before. I have also not utilized anything that require the pcfiles server. I frequently do however use the XLS engine through proc import/export and have experienced very few issues (mostly under 64bit unix). The XLS engine cannot read the newer versions of excel documents (2007++) where they switched from .xls type extensions to .xlsx types so usually in this situation I convert the document, through excel to a compatible format and then import the new file.
I remembered one additional way to access excel file data through SAS. If you have the SAS/Access module for odbc connection you could read excel files through the excel odbc driver...
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.