Hi SAS experts:
Is there anyway we can import excels into SAS when excels' format does not match the extension? See attached photo. I can open the excel by simply clicking "yes."
Here is the SAS log:
2181 PROC IMPORT OUT=jpmorgan DATAFILE= "C:\Users\Research.xls" DBMS=xls REPLACE;
2181! GETNAMES=YES; RUN;
Spreadsheet isn't from Excel V5 or later. Please open it in Excel and Save as V5 or later
Requested Input File Is Invalid
ERROR: Import unsuccessful. See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Thank you!
Easiest might be to open the "xls" file in Excel and do a File Save As into a CSV file and import that.
Or do a File Save As to XLSX using Excel as recommended by the SAS error message.
Then you're best off using a VBS script to convert them all to XLSX. There's a SAS macro on here that does it, see the link below:
http://support.sas.com/kb/43/496.html
Once they're XLSX you can use PROC IMPORT. If the file formats are the same though, you may want to consider CSV instead. You can change the type by changing the number and extension on the Excel file Save As command:
mybook.SaveAs ""&default.\"" & Filename & "".xlsx"", 51";
CSV looks to be Number 6 instead:
https://msdn.microsoft.com/en-us/vba/excel-vba/articles/xlfileformat-enumeration-excel
Hi SAS experts:
Is there anyway we can import excels into SAS when excels' format does not match the extension? See attached photo. I can open the excel by simply clicking "yes."
Here is the SAS log:
2181 PROC IMPORT OUT=jpmorgan DATAFILE= "C:\Users\Research.xls" DBMS=xls REPLACE;
2181! GETNAMES=YES; RUN;Spreadsheet isn't from Excel V5 or later. Please open it in Excel and Save as V5 or later
Requested Input File Is Invalid
ERROR: Import unsuccessful. See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Thank you!
That is great. Thank you! Later one friend solved this problem for me by writing some python codes.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.