Here is the step:
data _null_;
infile original dsd truncover lrecl=32767;
file fixed lrecl=1000000;
input line :$char32767. ;
if notdigit(scan(line,1,','))
and length(scan(line,1,','))>12 then put '|' @;
else put;
len=lengthn(line);
put line $varying32767. len @;
run;
The IF/THEN/ELSE is what is deciding whether or not to write an end of line. When the condition is true it writes the | without writing an end of line. Otherwise it writes just the end of line. Then it writes the current line it just read, but without an end of line. The trailing at sign on the PUT statement is what stops it from writing the end of line. Note that the last line written by a data step will automatically get an end of line added.
The test in the IF statement is checking whether the beginning of the current line (up to the first comma) does NOT look like a valid value for your first column. This is the most likely place where you might need to adjust the logic for a different version of the file.
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: