- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm writing a text file using the following code
filename out "file_name.txt";
data _null_;
set dataA end=eof;
file out;
outline= cats(var1, var2, var3,'09'x);
put outline;
if eof then put "last_line_txt.";
run;
I get a text file where at the end of each line there are CR LF LF
(created by the '09'x)
I need only CR LF (without the second LF)
How do I do that?
I tried 'ODOA'x instead of the '09'x, but that does not work.
Thank you!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"09"x is a tab, not a LF. LF is "0A"x.
To manipulate the end-of-line, use the TERMSTR option:
file out termstr=CRLF;
outline= cats(var1, var2, var3);
put outline;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"09"x is a tab, not a LF. LF is "0A"x.
To manipulate the end-of-line, use the TERMSTR option:
file out termstr=CRLF;
outline= cats(var1, var2, var3);
put outline;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Works great, Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you want full control use the RECFM=N option on the FILE statement.
data _null_;
set dataA end=eof;
file out recfm=n ;
outline= cats(var1, var2, var3,'0D0A'x);
put outline;
if eof then put "last_line_txt.";
run;
Is there some reason why you need to make the writing of a text file so complicated?
Why are you not writing the end of line characters on the last line of the file?