<?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 Automatic creation of datasets based on variable value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58551#M12678</link>
    <description>Hi all,&lt;BR /&gt;
            I want to create multiple datasets based on variable 'x' value. &lt;BR /&gt;
&lt;BR /&gt;
            The below example shows how to create the datasets using IFthen.  But there are more than 200 disnict values of 'x' in the Real dataset, hence I need a more efficient way of doing it rather than specifying individual If Then.&lt;BR /&gt;
  &lt;BR /&gt;
           data test1;&lt;BR /&gt;
                   input x;&lt;BR /&gt;
                   datalines;&lt;BR /&gt;
                   2&lt;BR /&gt;
                   3&lt;BR /&gt;
                   2&lt;BR /&gt;
                   1&lt;BR /&gt;
                   2&lt;BR /&gt;
                   1&lt;BR /&gt;
                   3&lt;BR /&gt;
                  ;&lt;BR /&gt;
                  run;&lt;BR /&gt;
&lt;BR /&gt;
               data out.temp1 out.temp2 out.temp3;&lt;BR /&gt;
                set test1;&lt;BR /&gt;
                if x eq 1 then output out.temp1;&lt;BR /&gt;
                if x eq 2 then output out.temp2;&lt;BR /&gt;
                if x eq 3 then output out.temp3;&lt;BR /&gt;
                run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
  Thanks for your help,&lt;BR /&gt;
&lt;BR /&gt;
Amit</description>
    <pubDate>Fri, 24 Jul 2009 16:11:47 GMT</pubDate>
    <dc:creator>AmitKB</dc:creator>
    <dc:date>2009-07-24T16:11:47Z</dc:date>
    <item>
      <title>Automatic creation of datasets based on variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58551#M12678</link>
      <description>Hi all,&lt;BR /&gt;
            I want to create multiple datasets based on variable 'x' value. &lt;BR /&gt;
&lt;BR /&gt;
            The below example shows how to create the datasets using IFthen.  But there are more than 200 disnict values of 'x' in the Real dataset, hence I need a more efficient way of doing it rather than specifying individual If Then.&lt;BR /&gt;
  &lt;BR /&gt;
           data test1;&lt;BR /&gt;
                   input x;&lt;BR /&gt;
                   datalines;&lt;BR /&gt;
                   2&lt;BR /&gt;
                   3&lt;BR /&gt;
                   2&lt;BR /&gt;
                   1&lt;BR /&gt;
                   2&lt;BR /&gt;
                   1&lt;BR /&gt;
                   3&lt;BR /&gt;
                  ;&lt;BR /&gt;
                  run;&lt;BR /&gt;
&lt;BR /&gt;
               data out.temp1 out.temp2 out.temp3;&lt;BR /&gt;
                set test1;&lt;BR /&gt;
                if x eq 1 then output out.temp1;&lt;BR /&gt;
                if x eq 2 then output out.temp2;&lt;BR /&gt;
                if x eq 3 then output out.temp3;&lt;BR /&gt;
                run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
  Thanks for your help,&lt;BR /&gt;
&lt;BR /&gt;
Amit</description>
      <pubDate>Fri, 24 Jul 2009 16:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58551#M12678</guid>
      <dc:creator>AmitKB</dc:creator>
      <dc:date>2009-07-24T16:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic creation of datasets based on variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58552#M12679</link>
      <description>Hello Amit.&lt;BR /&gt;
&lt;BR /&gt;
Easily achieved with the output method of the Hashing object.&lt;BR /&gt;
&lt;BR /&gt;
See the "SPLITTING A SAS FILE DYNAMICALLY USING THE .OUTPUT() METHOD" topic of this excellent paper by Paul M. Dorfman and Koen Vyverman:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi30/236-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/236-30.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Fri, 24 Jul 2009 16:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58552#M12679</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-07-24T16:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic creation of datasets based on variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58553#M12680</link>
      <description>Something I should add...&lt;BR /&gt;
&lt;BR /&gt;
There is some limitation about the size (num. of colums X num. rows) that can be allocated into memory through the hash object.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Fri, 24 Jul 2009 17:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58553#M12680</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-07-24T17:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic creation of datasets based on variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58554#M12681</link>
      <description>Daniel's paper is very good indeed, and if there is too much data for the hash tables, you can look at the example just above the one he mentions.&lt;BR /&gt;
&lt;BR /&gt;
Also, I would add &lt;BR /&gt;
  hid.delete ( );&lt;BR /&gt;
just before the run; statement: use option fullstimer to see that memory usage should be reduced this way.</description>
      <pubDate>Mon, 27 Jul 2009 02:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatic-creation-of-datasets-based-on-variable-value/m-p/58554#M12681</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-07-27T02:51:08Z</dc:date>
    </item>
  </channel>
</rss>

