I have a couple of variables that have long text data in excel. When I import it with import statement it stops at 175 characters. I want to be able to get full text length.
PROC IMPORT OUT= WORK.ge DATAFILE= "filepath/name"
DBMS=xlsx REPLACE;
SHEET="One";
GETNAMES=YES;
RUN;
Thank you
@hyo_tree wrote:
Hi rajd1,
please give the length of the variable you want to store the long text. Because SAS will default that the length of this variable is the length of the first data value you entered.
@hyo_tree This statement is not correct. Proc Import with the XLSX engine will use the longest string to assign the variable length.
Below code reads the attached Excel where the longest string for column VarA is in cell A5000 - and it gets it right.
What happens on your end if you use this code to read the attached Excel?
proc import
out= work.ge
datafile= "~/test/test.xlsx"
dbms=xlsx
replace;
sheet="one";
getnames=yes;
run;
proc contents data=work.ge;
run;quit;
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.