My xlsx file has 103465 records when I use the following code or import wizard it only importing 96508 records. What is te best menthod to import all the records into SAS to process?
libname tf xlsx "c:\temp\test.xlsx";
data temp;
tf.sheet1;
run;
Thank you
Save the spreadsheet to a csv file, inspect that with a text editor to verify its contents, then read it with a data step.
Could it be that "sheet1" is not a sheetname, but a named range?
Hello! I'm a student who recently learned SAS so bear with me.
There shouldn't be a limit for the number of records. Is there more than 1 sheet in the file? If there are and the rest of the records are on another sheet you need to specify each sheet. For example, since you're importing an Excel file you could try and use PROC IMPORT and then use this statement: SHEET = "Sheet1"; (or whatever the title of the sheets are). You would have to do a separate PROC IMPORT for each sheet though. Here's a link that provides more detail: https://communities.sas.com/t5/SAS-Procedures/PROC-IMPORT-multiple-sheets/td-p/149597
Hope that helps!
I only have one sheet and the sheetname is Sheet1. Saved the xlsx file as CSV still not able to import all the records. I have about 100 variables and 103K records not sure if I want to write a datastep.
Can you post the log, please.
@Stalk - You can use PROC IMPORT with the DBMS = CSV option to both import your CSV and also to generate DATA step code automatically. You may need to use - OPTIONS SOURCE; - to make the DATA step code visible in your SAS log.
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.