<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Carriage Return on output (Text file) - how to remove? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273996#M54626</link>
    <description>&lt;P&gt;Here is an example. Is this file for windows or for unix ?&lt;/P&gt;
&lt;P&gt;Windows use '0D0A'x&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unix use '0A'x&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set sashelp.class end=last;
 file '/folders/myfolders/want.txt' recfm=n ;
 put name +(-1)'|' sex  +(-1)'|'  age  +(-1)'|' weight @;
 if not last then put '0D0A'x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 May 2016 01:07:48 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-05-31T01:07:48Z</dc:date>
    <item>
      <title>Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273973#M54616</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble with my output (Text) file. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;P&gt;data null;&lt;BR /&gt;file &amp;amp;file3 linesize=3200 dlm='|' ;&lt;BR /&gt;set USDATM_&amp;amp;MTH. end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if _n_= 1 then do;&lt;BR /&gt;&lt;BR /&gt;put&lt;BR /&gt;'ATM_ID'&lt;BR /&gt;'|ATM_ALT_ID'&lt;BR /&gt;'|ATM_USD_CSH_IND'&lt;BR /&gt;;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;put&lt;BR /&gt;atm_id&lt;BR /&gt;atm_alt_id&lt;BR /&gt;atm_usd_csh_ind&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if eof and char in ('0D'x, '0A'x) then&lt;BR /&gt;put @;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output looks like this:&lt;/P&gt;&lt;P&gt;VAR1|VAR2|VAR3&lt;BR /&gt;ABC5|FD53|Y&lt;BR /&gt;DEF0|FE78|Y&lt;BR /&gt;FDS9|EW38|Y&lt;BR /&gt;FDR4|QW82|Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to remove the extra line at the bottom..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 20:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273973#M54616</guid>
      <dc:creator>TD-A</dc:creator>
      <dc:date>2016-05-30T20:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273978#M54619</link>
      <description>&lt;P&gt;Why not take out the statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if eof and char in ('0D'x, '0A'x) then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;put @;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 21:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273978#M54619</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-05-30T21:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273996#M54626</link>
      <description>&lt;P&gt;Here is an example. Is this file for windows or for unix ?&lt;/P&gt;
&lt;P&gt;Windows use '0D0A'x&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unix use '0A'x&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set sashelp.class end=last;
 file '/folders/myfolders/want.txt' recfm=n ;
 put name +(-1)'|' sex  +(-1)'|'  age  +(-1)'|' weight @;
 if not last then put '0D0A'x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 May 2016 01:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/273996#M54626</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-05-31T01:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274120#M54654</link>
      <description>&lt;P&gt;You may want to look at the TERMSTR option on your FILE statement. It sets whether the end of line is CRLF (windows default) LF&amp;nbsp; or NL&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 15:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274120#M54654</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-31T15:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274447#M54761</link>
      <description>Thanks so much, Xia Keshan. I'm remotely connecting to UNIX but my output is saved in a shared network (on Windows). I've tried your solution but there is a space after the last field/column and the first line went to the 'header line'. e.g. ATM_ID|ATM_ALT_ID|ATM_USD_CSH_INDNE4|NA5|Y RE8|RE7|Y JB9|JA3|Y HG4|HD8|Y Really appreciate your help.</description>
      <pubDate>Wed, 01 Jun 2016 18:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274447#M54761</guid>
      <dc:creator>TD-A</dc:creator>
      <dc:date>2016-06-01T18:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274453#M54763</link>
      <description>Hi again Xia Keshan, I've resolved the issue with the space (' ') after the column/field but not the first line that's joining the header or the first row. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; So, I did: put atm_id +(-1)'|' atm_alt_id +(-1)'|' atm_usd_csh_ind +(-1)@ ; although there is still a ' ' at the very last row after the column/field..</description>
      <pubDate>Wed, 01 Jun 2016 18:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274453#M54763</guid>
      <dc:creator>TD-A</dc:creator>
      <dc:date>2016-06-01T18:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274519#M54800</link>
      <description>&lt;P&gt;OK. Try this one .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set sashelp.class end=last;
 file '/folders/myfolders/want.txt' recfm=n dlm='|';
 if _n_=1 then put "Name|sex|age|weight" '0D0A'x;

 put name  sex  age weight ;
 if not last then put  '0D0A'x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 00:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/274519#M54800</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-02T00:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275523#M55093</link>
      <description>Thanks again, Xia Keshan! It worked this time, but there's a '|' at the end of every row. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Mon, 06 Jun 2016 20:28:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275523#M55093</guid>
      <dc:creator>TD-A</dc:creator>
      <dc:date>2016-06-06T20:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275544#M55100</link>
      <description>&lt;P&gt;OK. How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set sashelp.class end=last;
 file '/folders/myfolders/want.txt' recfm=n;
 if _n_=1 then put "Name|sex|age|weight" '0D0A'x;

 put name +(-1)'|'  sex +(-1)'|' age +(-1)'|' weight ;
 if not last then put +(-1) '0D0A'x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2016 01:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275544#M55100</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-07T01:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275717#M55172</link>
      <description>Yes, that solved it but, there's still a ' ' after the last field/column at the bottom. so, it's like: name|sex|age XXXX|F|25 and I have like 12 text files (output files), I have to open each one to remove that extra ' '. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Tue, 07 Jun 2016 15:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275717#M55172</guid>
      <dc:creator>TD-A</dc:creator>
      <dc:date>2016-06-07T15:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275837#M55219</link>
      <description>&lt;P&gt;OK. This is really not easy. This code ought to be right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set sashelp.class end=last;
 file '/folders/myfolders/want.txt' recfm=n;
 if _n_=1 then put "Name|sex|age|weight" '0D0A'x;
 length x $ 4000;
 x=catx('|',name,sex,age,weight);
 len=length(x);
 put x $varying4000. len ;
 if not last then put '0D0A'x;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jun 2016 01:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/275837#M55219</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-08T01:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Carriage Return on output (Text file) - how to remove?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/279802#M56429</link>
      <description>Thanks so much, Xia Keshan! This is the answer indeed! Thank you, thank you, thank you so much! Sorry for not getting back to you any sooner. I've been busy with other projects.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jun 2016 19:09:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Carriage-Return-on-output-Text-file-how-to-remove/m-p/279802#M56429</guid>
      <dc:creator>TD-A</dc:creator>
      <dc:date>2016-06-23T19:09:59Z</dc:date>
    </item>
  </channel>
</rss>

