<?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: Getting an extra Blank line at end of file while creating a txt file. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619438#M181856</link>
    <description>&lt;P&gt;How do you inspect your txt file?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 09:21:25 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-01-23T09:21:25Z</dc:date>
    <item>
      <title>Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619435#M181855</link>
      <description>&lt;P&gt;I have been trying to create a txt file with a format such as 1st row as header, from 2nd row i have datalines and last row as a trailer record. Requirement is LF(line feed) as record terminator. With the current code I am able to achieve LF as the record terminator, but this adds a extra blank line at end of file(which is not required).&amp;nbsp; Any solution for this would help.&lt;/P&gt;&lt;P&gt;my code looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let _PREX12_FILE = &amp;amp;_ddpath.&amp;amp;_dd_sdir./&amp;amp;FILENAME..txt;&amp;nbsp; &amp;nbsp;this is my path to unix server where file will be created&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET &amp;amp;INFILE._HDR ;&lt;BR /&gt;FILE "&amp;amp;_PREX12_FILE." NEW TERMSTR=LF recfm=n ;&lt;BR /&gt;%PREX12_HDR;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET &amp;amp;INFILE._UNION_DATA;&lt;BR /&gt;FILE "&amp;amp;_PREX12_FILE." MOD ;&lt;BR /&gt;IF RECORD_TP_FLAG = '0100' THEN&lt;BR /&gt;PUT %PUT_CSV_100;&lt;/P&gt;&lt;P&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;DATA _NULL_;&lt;BR /&gt;SET &amp;amp;INFILE._TLR ;&amp;nbsp; &amp;nbsp; &amp;nbsp;/this is my input dataset containig a single line trailer data*/&lt;BR /&gt;FILE "&amp;amp;_PREX12_FILE." MOD TERMSTR=LF&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;PUT&lt;/P&gt;&lt;P&gt;RECORD_TYPE $7.&lt;BR /&gt;REC_CNT $10.&lt;BR /&gt;FILE_DATE YYMMDDN.&lt;BR /&gt;FILE_TIME B8601TM6.&lt;BR /&gt;TRANS_CNT $10.&lt;BR /&gt;TRANS_AMT $15.&lt;BR /&gt;FILLER $100.&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had tried using the RECFM = n option inthe last DATA _null_ step but no success.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 09:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619435#M181855</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-23T09:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619438#M181856</link>
      <description>&lt;P&gt;How do you inspect your txt file?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 09:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619438#M181856</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-23T09:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619440#M181858</link>
      <description>&lt;P&gt;Tried over the Unix server and also transfering over windows server.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 09:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619440#M181858</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-23T09:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619441#M181859</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269825"&gt;@Anmolkhandelwal&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Tried over the Unix server and also transfering over windows server.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But how do you look at the file? Notepad++, Windows Editor, vi on UNIX, ....?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 09:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619441#M181859</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-23T09:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619442#M181860</link>
      <description>&lt;P&gt;Opening it on NOTEPAD++&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 09:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619442#M181860</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-23T09:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619443#M181861</link>
      <description>&lt;P&gt;So if you switch to hex display, you see &lt;U&gt;two&lt;/U&gt; 0A at the end?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 09:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619443#M181861</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-23T09:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619446#M181862</link>
      <description>&lt;P&gt;ttaching the Text file which i have exported. My concerned line is the highlighted one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 07:54:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619446#M181862</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-24T07:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619447#M181863</link>
      <description>&lt;P&gt;Does this last line end with a LF if you scroll to the right?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 10:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619447#M181863</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-23T10:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619455#M181870</link>
      <description>&lt;P&gt;No. Just the spaces till the End of line.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 10:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619455#M181870</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-23T10:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619465#M181878</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269825"&gt;@Anmolkhandelwal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this will help you:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename f temp;

data _null_;
  file f recfm=n;
  if _N_ = 1 then put "This is header" '0a'x @;
  set sashelp.class end=eof;
  put age name height '0a'x @;
  if eof then put "This is footer";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 11:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619465#M181878</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-01-23T11:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619476#M181887</link>
      <description>&lt;P&gt;I ran this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;

FILE "$HOME/sascommunity/test.txt" NEW TERMSTR=LF ;
put 'Header';
RUN;

DATA _NULL_;
SET sashelp.class;
FILE "$HOME/sascommunity/test.txt" MOD ;
put (_all_) (:);

RUN;

DATA _NULL_;
record_type = 'TRAILER';
rec_cnt = '     10600';
file_date = '23jan2020'd;
file_time = '04:44:17't;
trans_cnt = '       500';
trans_amt = '        2207418';
length filler $100;
filler = "";
FILE "$HOME/sascommunity/test.txt" MOD TERMSTR=LF  ;

PUT

RECORD_TYPE $7.
REC_CNT $10.
FILE_DATE YYMMDDN.
FILE_TIME B8601TM6.
TRANS_CNT $10.
TRANS_AMT $15.
FILLER $100.

;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and the file ended with the single '0A'x after the 100 bytes of the filler. Are you sure that there's no additional step trying to write to the file?&lt;/P&gt;
&lt;P&gt;How many blanks do you have in that last incomplete line?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 12:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619476#M181887</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-23T12:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619850#M182064</link>
      <description>&lt;P&gt;Nope not writing any thing to the file after the trailer line.&lt;/P&gt;&lt;P&gt;Following&amp;nbsp; it as the above code.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 16:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619850#M182064</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-24T16:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619868#M182078</link>
      <description>&lt;P&gt;We cannot test with the code you posted since we do not have either the input data or the definition of the macros you are calling.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I suspect that the file is fine and there is some type of misunderstanding about how text files are constructed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like whatever tool you are using to look at the file is showing an extra line.&amp;nbsp; If you are using a text editor then they will generally show an extra line so that you have some place to type new text you want to add at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To check how the file really ends read the file using a SAS data step and dump the text using $HEX format to see exactly what is there at the end.&amp;nbsp; For a small sample file just dump the whole file.&amp;nbsp; To test a larger file you might want to skip the beginning so as not to flood the log with information you don't need.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename text temp;
data _null_;
  file test;
  put 'line one'
    / 'line two'
  ;
run;

data _null_;
  infile test recfm=f lrecl=10;
  input;
  list;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+--

1   CHAR  line one..
    ZONE  6666266600
    NUMR  C9E50FE5DA

2   CHAR  line two..
    ZONE  6666277600
    NUMR  C9E5047FDA
NOTE: 2 records were read from the infile TEST.
&lt;/PRE&gt;
&lt;P&gt;As you can see in this example, run on Windows, each line ends with CR and LF characters (0D and 0A in hex codes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some programs (programmers?) have a mental model of a file as a series of records instead of a series of lines. In this model they think it makes sense to not include that final end of line marker at the end of the file.&amp;nbsp; So when it is there they think it means there is a "record" with zero bytes at the end of the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you cannot fix the system that is reading the file to accept text files as they should be constructed then you need to tell SAS not the write the end of line on the last line.&amp;nbsp; One way is to write the file using RECFM=N and explicitly write the end of line, or record separators, manually.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename text temp;
data _null_;
  file test recfm=n ;
  put 'line one' '0D0A'x
    / 'line two' 
  ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To make it easier you might just add the last line separately from the other lines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename text temp;
data _null_;
  file test ;
  put 'line one' 
    / 'line two' 
  ;
run;

data _null_;
  file test mod recfm=n ;
  put 'last line' ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you can see the last line will be just 9 bytes long and not have any end of line characters.&lt;/P&gt;
&lt;PRE&gt;RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+--

1   CHAR  line one..
    ZONE  6666266600
    NUMR  C9E50FE5DA

2   CHAR  line two..
    ZONE  6666277600
    NUMR  C9E5047FDA
3         last line 9
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 18:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/619868#M182078</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-24T18:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620129#M182179</link>
      <description>&lt;P&gt;I have tried this approach. Tried writing the last line in a different data _null_ with recfm = n and no "0a" as terminator with my put statements, this does remove the extra line that was created earlier but the terminator for this trailer comes to be blank. i am trying to get the terminator as LF for last line without generating a blank line after that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 10:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620129#M182179</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-27T10:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620130#M182180</link>
      <description>Could you check if you have a Line Feed, carriage return or New Line character in FILLER/TRANS_AMT or any other variable. They can cause to create a new line.</description>
      <pubDate>Mon, 27 Jan 2020 11:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620130#M182180</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2020-01-27T11:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620767#M182464</link>
      <description>&lt;P&gt;I just reran my code from my previous post on University Edition on a Mac, and inspected the resulting text file with hexdump. There is one single '0a'x at the end of the file after the filler, and no additional blanks. So those additional blanks must be added by something else you use after SAS writes the file.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 08:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620767#M182464</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-29T08:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620920#M182492</link>
      <description>&lt;P&gt;Thanks for the help. Will update if i get my codes working. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 17:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/620920#M182492</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2020-01-29T17:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an extra Blank line at end of file while creating a txt file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/621267#M182626</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269825"&gt;@Anmolkhandelwal&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have tried this approach. Tried writing the last line in a different data _null_ with recfm = n and no "0a" as terminator with my put statements, this does remove the extra line that was created earlier but the terminator for this trailer comes to be blank. i am trying to get the terminator as LF for last line without generating a blank line after that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS will normally write a space after a&amp;nbsp; VARIABLE when writing using list mode.&amp;nbsp; It does not do that after fixed text in the PUT statement, like in my example.&lt;/P&gt;
&lt;P&gt;To avoid this use formatted mode instead.&amp;nbsp; You can use the $VARYING with character variables.&lt;/P&gt;
&lt;P&gt;Say you have a character variable named MYVAR that is defined with a length of 200.&amp;nbsp; So instead of using:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put myvar;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You would use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;len=lengthn(myvar);
put myvar $varying200. len;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jan 2020 18:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-an-extra-Blank-line-at-end-of-file-while-creating-a-txt/m-p/621267#M182626</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-30T18:28:39Z</dc:date>
    </item>
  </channel>
</rss>

