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;
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: