Is there a way to import the first sheet from an excel file, without specifying the name of the sheet.
PROC IMPORT
DATAFILE= "filePath\fileName.xlsx"
DBMS=EXCEL REPLACE
OUT= _fileName_OUT.;
SHEET = 'sheetName';
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
So instead of using the "sheetName" parameter, I am looking for a generic term that would specify that it should be the first sheet in the excel file.
SAS automatically imports the "first" sheet in the excel file, for a certain definition of first, if you don't use the sheet statement. So if you simply proc import the file without specifying sheet, you'll get whatever the first is. But it won't be necessarily the left-most; it's the first in Excel's internal thinking.
Also, the dbms you use matters. EXCEL and XLSX do different things. EXCEL seems to take the original SHEET1; XLSX seems to take the left most sheet, by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With