05-06-2015 12:50 AM
I'm using the following to create a text delimited file. However for the fields that have null value, the output text file is generating a space between the delimiters. Is there any way to get rid of the blanks ?
I cannot use proc export as I cannot customise the header and trailer (or is it possible to customise headers/trailers in proc export ?)
format dt YMDHMS.;
format Business_Date b8601da.;
format OBS Z8.;
format amount_SUM Z20.;
set sas_extract_formatted end=EFIEOD NOBS=OBS;
FILE 'C:\Users\f051615\rawfile.txt' DLM='~' LINESIZE=1000; /* Output Text File */
if _n_ = 1 then do;
PUT "H~SASX~" Business_Date dt;
|if EFIEOD then do;|
|PUT "T~" OBS CEA_SUM;|
05-06-2015 08:08 AM
Your code was either not correctly pasted or contains errors. The second PUT lacks a semicolon before the end;
I also think that you wanted to output amount_SUM instead of CEA_SUM in the final PUT
To suppress the blanks for empty strings, use the DSD option in the FILE statement.
05-07-2015 07:40 AM
Then please mark the question as answered.