Hi,
Environment : SAS ODAMID/ SAS Studio
I am trying to create a dataset using datalines, wherein one of the columns has leading spaces. I want to keep the leading spaces in the created dataset which is not happening by default.
Would appreciate any help. Thanks in advance.
Example
data exp3;
infile datalines delimiter=",";
INPUT SNO :8. cat :$150.;
datalines;
1, main category
2, sub category
;
run;
Output (Default)
It's an informat thing. Use the $Charw. instead like this
data exp3;
infile datalines delimiter=",";
INPUT SNO :8. cat :$char150.;
datalines;
1, main category
2, sub category
;
run;
It's an informat thing. Use the $Charw. instead like this
data exp3;
infile datalines delimiter=",";
INPUT SNO :8. cat :$char150.;
datalines;
1, main category
2, sub category
;
run;
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 25. 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.