Reputation: 1047
I want to import a database of excel to SAS, I use the correct commands but SAS tells me the following errors:
ERROR: Connect: ERROR:Error in the LIBNAME statement sas
libname dir 'E:\SAS\sessio2\dades';
proc import out=dir.m
datafile="E:\SAS\sessio2\dades\matrimonios.xlsx"
DBMS=excel
replace;
RANGE="Hoja1$A1:AJ54";
getnames=yes;
run;
Upvotes: 1
Views: 7457
Reputation: 1078
I'm not sure if it's your libname statement path that is incorrect or the version of your SAS. if you're using datafile=
"path.xlsx"
, then try using DBMS=.xlsx
as well.
If that doesn't work, perhaps try changing datafile=
from .xlsx
to .xls
I'm not sure which version of SAS you have.
But in 9.1.3 it's better to use .xls
If your excel file is in .xlsx
, just open it and save as 2003 .xls
version. Your code seems to work fine on my computer but that's using my own excel file.
libname dir 'C:\sasdata';
proc import out=dir.m
datafile="C:\sasdata\sfosch.xls"
DBMS=excel
replace;
*RANGE="Hoja1$A1:AJ54";
getnames=yes;
run;
Upvotes: 1
Reputation: 12465
As Yick says, the error is in your PROC IMPORT
statement. Behind the scenes PROC IMPORT creates a LIBNMAE statement using the EXCEL engine.
Some things that might be wrong:
Upvotes: 2