One way of looking at the problem is that you're not losing the blanks, you are just left aligning your character variable. So right align it and add blanks. The RIGHT function will right-align the variable when output.
I took data_null_'s code and dropped the "-R" and got what I think that cjohnson is looking for. (SAS 9.2 TS2M3).
cjohnson, If you are still having problems, maybe you can explain more fully. Another way to debug this is to print the data with the hex format so you can precisely tell what is in there.
Doc Muhlbaier
Duke
data _null_;
length SubmissionRecordCount $20;
input @0021 SubmissionRecordCount $CHAR8.;
put '12345678901234567890';
put (S:) ($char20.);
cards;
SC010024201103241201 1468
;;;;
run;
10 data _null_;
11 length SubmissionRecordCount $20;
12 input @0021 SubmissionRecordCount $CHAR8.;
13 put '12345678901234567890';
14 put (S:) ($char20.);
15 cards;
Ah...you are right. The leading blanks were being preserved. I couldn't see it in the table view, but when I also added the $char format to the export, it kept the blanks. Thanks very much!
Christopher Johnson www.codeitmagazine.com
The 2025 SAS Hackathon Kicks Off on June 11!
Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.