Hello,
I am using PROC IMPORT to read a file DBMS=XLSX but truncation is occurring for some vars. How can I define the variables which come in to be a specific length?
Any help will be Liked promptly.
Many thanks,
Mark
You don't have much control over the file if it's XLSX. The best way is to convert it to CSV and then you can use DATA step with infile and define the data attributes you like or you can use PROC IMPORT with GUESSINGROWS= to tell sas to scan all the observation to define the data type instead of default 20.
Note: GUESSINGROWS works only for delimited files.
You don't have much control over the file if it's XLSX. The best way is to convert it to CSV and then you can use DATA step with infile and define the data attributes you like or you can use PROC IMPORT with GUESSINGROWS= to tell sas to scan all the observation to define the data type instead of default 20.
Note: GUESSINGROWS works only for delimited files.
GUESSINGROWS= will not work for XLSX files.
You may try this:
Found this here and not sure if that works.
What you describe shouldn't happen with the XLSX engine.
Can you give us an example of the kind of truncation you're observing?
If possible: Can you post an Excel with some sample data with which you experience such truncation so we can test if that's replicable for us or limited to your environment. Also: What SAS version in what OS are you using?
What I've posted probably 300 times or more here: save to csv from Excel and read with a data step. Excel files are ***** for data transfer.
Try this :
libname x xlsx '/folders/myfolders/ntile.xlsx' dbmax_text=32767;
proc copy in=x out=work noclone;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.