BookmarkSubscribeRSS Feed
Stalk
Pyrite | Level 9

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

 

7 REPLIES 7
jporterf
Fluorite | Level 6

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!

Stalk
Pyrite | Level 9

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.

andreas_lds
Jade | Level 19

Can you post the log, please.

SASKiwi
PROC Star

@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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 927 views
  • 2 likes
  • 5 in conversation