Good Afternoon,
I'm attempting to export a file created in SAS to an external database and one of the fields is a free text field which appears to be exporting some records to do lines.
An example of how some of the fields look is as follows.
""" See printout stored in ABC area
(if not found consult document) """
Is there a way to fix these issues prior to export in order to have one record per line?
Any help is welcome.
Sean
You can either replace the CR and/or LF characters in your string. For example you might replace the LF's in the file with | character instead and then write that file to a CSV file.
data for_export;
set have;
array _c _character_;
do _n_=1 to dim(_c);
_c[_n_] = translate(_c[_n_],'|','0A'x);
end;
run;
Or possibly use something like the macro mentioned here to write the CSV file with quotes around values that including them.
You can either replace the CR and/or LF characters in your string. For example you might replace the LF's in the file with | character instead and then write that file to a CSV file.
data for_export;
set have;
array _c _character_;
do _n_=1 to dim(_c);
_c[_n_] = translate(_c[_n_],'|','0A'x);
end;
run;
Or possibly use something like the macro mentioned here to write the CSV file with quotes around values that including them.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.