<?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 export txt file to have end line character CR LF instead of LF in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/617300#M180864</link>
    <description>&lt;P&gt;For some reason, my data keeps exporting with a LR end line character instead of a CR LF end line character.&amp;nbsp; I have no idea if this can be fixed during the output in SAS but if it can that'd be great.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how my data looks:&lt;/P&gt;
&lt;P&gt;Memberid&amp;nbsp; level&lt;BR /&gt;xxx1 2&lt;BR /&gt;xxx2 2&lt;BR /&gt;xxx3 2&lt;BR /&gt;xxx4 2&lt;BR /&gt;xxx5 2&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And this is the code I'm using to export this data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA= work.new_data&lt;BR /&gt;outfile= "/windows/data_011420_0312.txt" &lt;BR /&gt;dbms = DLM replace;&lt;BR /&gt;delimiter="|";&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2020 20:13:09 GMT</pubDate>
    <dc:creator>jmmedina25</dc:creator>
    <dc:date>2020-01-14T20:13:09Z</dc:date>
    <item>
      <title>How to export txt file to have end line character CR LF instead of LF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/617300#M180864</link>
      <description>&lt;P&gt;For some reason, my data keeps exporting with a LR end line character instead of a CR LF end line character.&amp;nbsp; I have no idea if this can be fixed during the output in SAS but if it can that'd be great.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how my data looks:&lt;/P&gt;
&lt;P&gt;Memberid&amp;nbsp; level&lt;BR /&gt;xxx1 2&lt;BR /&gt;xxx2 2&lt;BR /&gt;xxx3 2&lt;BR /&gt;xxx4 2&lt;BR /&gt;xxx5 2&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And this is the code I'm using to export this data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA= work.new_data&lt;BR /&gt;outfile= "/windows/data_011420_0312.txt" &lt;BR /&gt;dbms = DLM replace;&lt;BR /&gt;delimiter="|";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 20:13:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/617300#M180864</guid>
      <dc:creator>jmmedina25</dc:creator>
      <dc:date>2020-01-14T20:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to export txt file to have end line character CR LF instead of LF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/617313#M180871</link>
      <description>&lt;P&gt;If you are running SAS on Unix then the default will be to use linefeed ('0A'x) as the end of line character.&amp;nbsp; If you are running on Windows then the default will be CRLF ('0D0A'x) instead.&amp;nbsp; You can use the TERMSTR= option on the FILENAME or FILE statement to control that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To write a delimited text file a DATA step with appropriate FILE and PUT statements is about all you need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you do feel a need to use PROC EXPORT instead then you will need add a FILENAME statement to define a fileref.&amp;nbsp; You will then reference the fileref in the PROC EXPORT statement instead of the raw physical filename. That way you have a place to put the TERMSTR= option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename out "/windows/data_011420_0312.txt" termstr=crlf ;
PROC EXPORT DATA= work.new_data
  outfile= out replace
  dbms = DLM 
;
  delimiter="|";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 20:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/617313#M180871</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-14T20:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to export txt file to have end line character CR LF instead of LF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/808879#M318948</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your comment was helpful in getting my file encoded with windows CRLF, but i'm noticing that it is causing many of the variables in my file to get dropped/removed. The code I use is exactly as you show, but also using encoding= 'UTF-8' and&amp;nbsp;options nobomfile as I need the file to be encoded in utf-8. Happy to share more info if needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering if you've run into this issue and have a potential fix. Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/808879#M318948</guid>
      <dc:creator>jhur514</dc:creator>
      <dc:date>2022-04-20T17:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to export txt file to have end line character CR LF instead of LF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/808892#M318955</link>
      <description>&lt;P&gt;Please start a NEW question instead of posting on a two year old thread.&amp;nbsp; You can include a link to this if you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Include the actual code you ran, any notes or errors from the SAS log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the problem that you values are too long for the default 32K record length?&amp;nbsp; If so then add the LRECL= option to the FILENAME statement to set something longer.&amp;nbsp; In general you can have any length then , but memory limits on particular operating systems might limit you to 10000000 bytes max for LRECL setting. Which should be way longer than any reasonable dataset would require.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 17:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-txt-file-to-have-end-line-character-CR-LF-instead/m-p/808892#M318955</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-20T17:25:46Z</dc:date>
    </item>
  </channel>
</rss>

