<?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 How to avoid random splitting of lines while writing output to a .txt file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772670#M245364</link>
    <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am trying read a freeform text from one field in a website and store in a table and trying to printout to a .txt file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;below text entered in the description field :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Testname Testname Ry text to test very long characters and pragaraph and sentences&amp;nbsp; &amp;nbsp; whether it fits to the website and table and more .&lt;/P&gt;
&lt;P&gt;Testname Testname RY 11111111-1&lt;BR /&gt;FI96 1111 1111 1111 1111&lt;BR /&gt;Rita Zamamamam&lt;BR /&gt;ES54 1111 1111 1111 1111 1111, NTSBESM1&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;while writing to file out.txt it splits to random lines like below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Harigopalo_0-1633602160451.png" style="width: 732px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64444iC1B267641D501D7C/image-dimensions/732x354?v=v2" width="732" height="354" role="button" title="Harigopalo_0-1633602160451.png" alt="Harigopalo_0-1633602160451.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Code used :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let _INPUT_table= Test_table;
%let form_attachment_path='\casedetails\casedescription.txt;
data _null_;
set &amp;amp;_INPUT_table. (obs=1 firstobs=1);
file "&amp;amp;form_attachment_path" TERMSTR=CRLF lrecl=100;
 put 'Description of damagae: ' description;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me to write data in expected format with out random line breaks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2021 10:41:37 GMT</pubDate>
    <dc:creator>learn_SAS_23</dc:creator>
    <dc:date>2021-10-07T10:41:37Z</dc:date>
    <item>
      <title>How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772670#M245364</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am trying read a freeform text from one field in a website and store in a table and trying to printout to a .txt file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;below text entered in the description field :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Testname Testname Ry text to test very long characters and pragaraph and sentences&amp;nbsp; &amp;nbsp; whether it fits to the website and table and more .&lt;/P&gt;
&lt;P&gt;Testname Testname RY 11111111-1&lt;BR /&gt;FI96 1111 1111 1111 1111&lt;BR /&gt;Rita Zamamamam&lt;BR /&gt;ES54 1111 1111 1111 1111 1111, NTSBESM1&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;while writing to file out.txt it splits to random lines like below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Harigopalo_0-1633602160451.png" style="width: 732px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64444iC1B267641D501D7C/image-dimensions/732x354?v=v2" width="732" height="354" role="button" title="Harigopalo_0-1633602160451.png" alt="Harigopalo_0-1633602160451.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Code used :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let _INPUT_table= Test_table;
%let form_attachment_path='\casedetails\casedescription.txt;
data _null_;
set &amp;amp;_INPUT_table. (obs=1 firstobs=1);
file "&amp;amp;form_attachment_path" TERMSTR=CRLF lrecl=100;
 put 'Description of damagae: ' description;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me to write data in expected format with out random line breaks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 10:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772670#M245364</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-10-07T10:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772675#M245367</link>
      <description>&lt;P&gt;Works with a suitable LRECL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
input description $200.;
datalines;
Testname Testname Ry text to test very long characters and pragaraph and sentences    whether it fits to the website and table and more .
Testname Testname RY 11111111-1
FI96 1111 1111 1111 1111
Rita Zamamamam
ES54 1111 1111 1111 1111 1111, NTSBESM1
;

data _null_;
set have;
file "~/test.txt" lrecl=200;
put description;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output file, when downloaded from ODA and opened with TextExit on the Mac:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Testname Testname Ry text to test very long characters and pragaraph and sentences    whether it fits to the website and table and more .
Testname Testname RY 11111111-1
FI96 1111 1111 1111 1111
Rita Zamamamam
ES54 1111 1111 1111 1111 1111, NTSBESM1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just set the LRECL high enough that the longest line is accommodated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 10:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772675#M245367</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-07T10:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772680#M245371</link>
      <description>Wow , Works as expected . Thanks a lot</description>
      <pubDate>Thu, 07 Oct 2021 11:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772680#M245371</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-10-07T11:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772685#M245374</link>
      <description>&lt;P&gt;&amp;nbsp;Some times it not working as expected for a very long data as in the attached file. The data splits in to multiple lines&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with below option&amp;nbsp;&lt;/P&gt;
&lt;P&gt;file "&amp;amp;attachment_path" TERMSTR=CRLF lrecl=300;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shall i increase the lrecl=2000&amp;nbsp; ? does it have any side effects ?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 11:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772685#M245374</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-10-07T11:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772690#M245376</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;In this case, for the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm" target="_blank" rel="noopener"&gt;FILE Statement&lt;/A&gt;&amp;nbsp;, where it says&lt;/P&gt;
&lt;H4 class="xisDoc-argument"&gt;LRECL=&lt;EM class="xisDoc-userSuppliedValue"&gt;logical-record-length&lt;/EM&gt;&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;specifies the logical record length of the output file.&lt;/P&gt;
&lt;SECTION class="xisDoc-tableWrap"&gt;
&lt;TABLE class="xisDoc-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="xisDoc-summaryDefault"&gt;Default&lt;/TH&gt;
&lt;TD class="xisDoc-summaryText"&gt;If you omit the LRECL= option, SAS chooses a value based on the operating environment's file characteristics.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="xisDoc-summaryInteraction"&gt;Interaction&lt;/TH&gt;
&lt;TD class="xisDoc-summaryText"&gt;Alternatively, you can specify a global logical record length by using the &lt;A tabindex="0" href="https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.4/lesysoptsref/n1li19l98i6929n1981oqr3wq46u.htm" target="_blank"&gt;LRECL system option&lt;/A&gt;. In SAS 9.4, the default value for the global LRECL system option is &lt;STRONG&gt;32767&lt;/STRONG&gt;. If you are using fixed-length records (RECFM=F), the default value for LRECL is 256.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/SECTION&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(emphasis by me)&lt;/P&gt;
&lt;P&gt;So you should first try to work without a specific LRECL, and only set it when you get an overflow.&lt;/P&gt;
&lt;P&gt;Note that, for the default RECFM=V, only the bytes needed will end up on each line, regardless of a larger LRECL.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 11:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772690#M245376</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-07T11:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772692#M245378</link>
      <description>&lt;P&gt;PS on UNIX systems (see &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/hostunx/p0upngkius4n84n17wt1u5znj2de.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;), the maximum value for LRECL is 1GB, while the default is 32767.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 11:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772692#M245378</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-07T11:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid random splitting of lines while writing output to a .txt file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772703#M245380</link>
      <description>Now it's more clear , thanks for quick help</description>
      <pubDate>Thu, 07 Oct 2021 12:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-avoid-random-splitting-of-lines-while-writing-output-to-a/m-p/772703#M245380</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-10-07T12:25:38Z</dc:date>
    </item>
  </channel>
</rss>

