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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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: