Reputation: 3082
According to below output, the leading to trimmed automatically for the fourth observations. cdefg -> cdefg.
Question: How can i retain the leading blank.
data chr2;
input string $ 1-25;
strLen = length(string);
compblStr = compbl(string);
compblLen = length(compblStr);
datalines;
abc 5678
abcd 78
bcdef 8
cdefg
;
run;
Upvotes: 2
Views: 626
Reputation: 1449
You need to use $charW. informat to keep training blanks. This informat preserves leading and trailing blanks.
data chr2;
input string $CHAR25.;
strLen = length(string);
compblStr = compbl(string);
compblLen = length(compblStr);
datalines;
abc 5678
abcd 78
bcdef 8
cdefg
;
Upvotes: 4