<?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: How to export data in txt file with fixed length? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-data-in-txt-file-with-fixed-length/m-p/780326#M248634</link>
    <description>Tried out the TERMSTR=CRLF option and it works.&lt;BR /&gt;data _NULL_;&lt;BR /&gt;set to_export;&lt;BR /&gt;filename outtext termstr=crlf;&lt;BR /&gt;put year @5 quarter @7 sin_no &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274655"&gt;@16&lt;/a&gt; gender &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153152"&gt;@17&lt;/a&gt; dob &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; income 9.-r;&lt;BR /&gt;run;</description>
    <pubDate>Tue, 16 Nov 2021 03:56:17 GMT</pubDate>
    <dc:creator>cokeyng</dc:creator>
    <dc:date>2021-11-16T03:56:17Z</dc:date>
    <item>
      <title>How to export data in txt file with fixed length?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-data-in-txt-file-with-fixed-length/m-p/780325#M248633</link>
      <description>&lt;P&gt;I have recently been asked to prepare some data in a txt file. The tricky part about this is that there is not delimiter between columns and text alignment some time has to be different. For example, a data set as below:&lt;/P&gt;&lt;P&gt;year quarter sin_no gender dob income&lt;/P&gt;&lt;P&gt;2012 Q1 123123123 M 19600103 87000&lt;/P&gt;&lt;P&gt;2013 Q1 123123123 M 19600103 103000&lt;/P&gt;&lt;P&gt;2013 Q1 123123156 F 19571020 130000&lt;/P&gt;&lt;P&gt;2014 Q1 123123789 F 19670912 90100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data should be export as&lt;/P&gt;&lt;P&gt;2012Q1123123123M19600103&amp;nbsp; &amp;nbsp; &amp;nbsp;87000&lt;/P&gt;&lt;P&gt;2013Q1123123123M19600103&amp;nbsp; &amp;nbsp;103000&lt;/P&gt;&lt;P&gt;2013Q1123123156F19571020&amp;nbsp; &amp;nbsp; 130000&lt;/P&gt;&lt;P&gt;2014Q1123123789F19670912&amp;nbsp; &amp;nbsp; &amp;nbsp; 90100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was doing my research and debating if I should use a data step or proc export to do the job.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I found that the data step and the put statment should do the magic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename outtext "~\export_data.txt";&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set to_export;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;filename outtext;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;put year&amp;nbsp;@5 quarter&amp;nbsp;@7 sin_no&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274655"&gt;@16&lt;/a&gt; gender&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153152"&gt;@17&lt;/a&gt; dob&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; income 9.-r;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only part that I am not able to figure out is the end of line. I would want to have CRLF even it is on a Unix envionment. Some post suggested using termstr=CRLF in the file statement, but when I check the documentation, the option is only available to the INFILE statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 03:51:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-data-in-txt-file-with-fixed-length/m-p/780325#M248633</guid>
      <dc:creator>cokeyng</dc:creator>
      <dc:date>2021-11-16T03:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to export data in txt file with fixed length?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-data-in-txt-file-with-fixed-length/m-p/780326#M248634</link>
      <description>Tried out the TERMSTR=CRLF option and it works.&lt;BR /&gt;data _NULL_;&lt;BR /&gt;set to_export;&lt;BR /&gt;filename outtext termstr=crlf;&lt;BR /&gt;put year @5 quarter @7 sin_no &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274655"&gt;@16&lt;/a&gt; gender &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153152"&gt;@17&lt;/a&gt; dob &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; income 9.-r;&lt;BR /&gt;run;</description>
      <pubDate>Tue, 16 Nov 2021 03:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-data-in-txt-file-with-fixed-length/m-p/780326#M248634</guid>
      <dc:creator>cokeyng</dc:creator>
      <dc:date>2021-11-16T03:56:17Z</dc:date>
    </item>
  </channel>
</rss>

