<?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 Saving multiple data sets into ascii files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177220#M33919</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the following code to separate a large data file into multiple smaller ones. For example, breaking down by the variable rep. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;libname saswork 'C:\Documents and Settings\comp$uss\Desktop\SAS'&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;data test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;input x y z group rep;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;1 2 3 1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 2 4 1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;1 1 3 2 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 2 8 3 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;3 3 2 4 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;3 4 5 4 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;3 5 6 5 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 1 1 5 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 3 4 5 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;proc sort data=test out=saswork.test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;by rep; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%Macro Split;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;select distinct rep into :w1 through :w9999 from test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%let nw = &amp;amp;sqlobs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%do i=1 %to &amp;amp;nw;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;saswork.out&amp;amp;&amp;amp;w&amp;amp;i&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;set test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;select (rep);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%do i=1 %to &amp;amp;nw;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;when (&amp;amp;&amp;amp;w&amp;amp;i) output saswork.out&amp;amp;&amp;amp;w&amp;amp;i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;Using this code, I can get multiple dataset: out1 out2 .... But, what I really want to do is to save these files as ascii files. In other words, I want to create out1.txt out2.txt ... simultaneously. I have tried a few ways, but so far to no avail. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;Can anyone help me with this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;SQ&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Dec 2013 00:30:21 GMT</pubDate>
    <dc:creator>sqliu</dc:creator>
    <dc:date>2013-12-19T00:30:21Z</dc:date>
    <item>
      <title>Saving multiple data sets into ascii files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177220#M33919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the following code to separate a large data file into multiple smaller ones. For example, breaking down by the variable rep. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;libname saswork 'C:\Documents and Settings\comp$uss\Desktop\SAS'&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;data test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;input x y z group rep;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;1 2 3 1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 2 4 1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;1 1 3 2 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 2 8 3 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;3 3 2 4 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;3 4 5 4 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;3 5 6 5 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 1 1 5 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;2 3 4 5 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;proc sort data=test out=saswork.test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;by rep; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%Macro Split;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;select distinct rep into :w1 through :w9999 from test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%let nw = &amp;amp;sqlobs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%do i=1 %to &amp;amp;nw;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;saswork.out&amp;amp;&amp;amp;w&amp;amp;i&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;set test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;select (rep);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%do i=1 %to &amp;amp;nw;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;when (&amp;amp;&amp;amp;w&amp;amp;i) output saswork.out&amp;amp;&amp;amp;w&amp;amp;i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: georgia, serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;Using this code, I can get multiple dataset: out1 out2 .... But, what I really want to do is to save these files as ascii files. In other words, I want to create out1.txt out2.txt ... simultaneously. I have tried a few ways, but so far to no avail. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;Can anyone help me with this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-family: georgia, serif;"&gt;SQ&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 00:30:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177220#M33919</guid>
      <dc:creator>sqliu</dc:creator>
      <dc:date>2013-12-19T00:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Saving multiple data sets into ascii files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177221#M33920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/Split_Data_into_Subsets" title="http://www.sascommunity.org/wiki/Split_Data_into_Subsets"&gt;http://www.sascommunity.org/wiki/Split_Data_into_Subsets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe there's a variation on the hash solution to extend it to CSV/TXT Files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 00:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177221#M33920</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-12-19T00:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Saving multiple data sets into ascii files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177222#M33921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza, I appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code you referred to me is beyond me... Is it possible achieve my goal by modifying the code I provided? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 00:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177222#M33921</guid>
      <dc:creator>sqliu</dc:creator>
      <dc:date>2013-12-19T00:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Saving multiple data sets into ascii files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177223#M33922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On second thought use the filevar option instead, page 3, second column in first paper. Easy to understand I think &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi27/p082-27.pdf" title="http://www2.sas.com/proceedings/sugi27/p082-27.pdf"&gt;http://www2.sas.com/proceedings/sugi27/p082-27.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or SAS example here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/24/599.html" title="http://support.sas.com/kb/24/599.html"&gt;24599 - Create multiple files from one data set&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 01:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177223#M33922</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-12-19T01:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Saving multiple data sets into ascii files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177224#M33923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! filevar works beautifully!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 02:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-multiple-data-sets-into-ascii-files/m-p/177224#M33923</guid>
      <dc:creator>sqliu</dc:creator>
      <dc:date>2013-12-19T02:21:41Z</dc:date>
    </item>
  </channel>
</rss>

