Hi,
In our SAS dataset which we have extracted the data from SAS , we have value as like below
"QWERTY
, xxx/ABCc Financial Services Ltd/XYX Wealth Limited"
not in a single line. When I proc export the dataset into a txt file , the line is getting broken and the below one (xxx/ABCc..) as a separate row in the txt file.
How to rectify the problem?? I think we have to resolve in the SAS dataset load rather than in proc export.
I have used compress = yes while creating the work.dataset but nothing works.
Please let me know the solution for this? Thanks.
You may have linefeeds in your data. Inspect the column in which the line break happens by displaying it with a $HEX format (format length must be double the defined variable length).
Linefeeds are hex 0A, carriage returns 0D.
If that is the case, use the TRANSLATE function to replace these special characters with blanks.
You may have linefeeds in your data. Inspect the column in which the line break happens by displaying it with a $HEX format (format length must be double the defined variable length).
Linefeeds are hex 0A, carriage returns 0D.
If that is the case, use the TRANSLATE function to replace these special characters with blanks.
Thanks Both.
The issue is with the line feed (Hex value - 0A). I have used compress function to resolve the issue.
NAME= compress(NAME, ,'kw');
SAS does not know how to read (or write) delimited files with end of line characters embedded into the value of a variable.
Best solution is to remove those characters from the value before writing the delimited file. For example by replacing them with spaces.
data for_export;
set have;
array _c _character_;
do over _c;
_c = translate(_c,' ','0A0D'x);
end;
run;
proc export data=for_export dbms=csv
file='want.csv'
;
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.