<?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 Increase values for random number of observations in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453147#M29225</link>
    <description>&lt;P&gt;Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder could anyone provide some guidance for the following query, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset for 10,000 households on income.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to see the impact of an increase in income of ranging between 500-1000 for a random 200 households can have on headline figures such as the percentage of the sample at risk of poverty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would anyone know how the best way to write a command to increase a variable between 500-1000 for a random 200 observations?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be most welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sean&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Apr 2018 11:31:33 GMT</pubDate>
    <dc:creator>Sean_OConnor</dc:creator>
    <dc:date>2018-04-11T11:31:33Z</dc:date>
    <item>
      <title>Increase values for random number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453147#M29225</link>
      <description>&lt;P&gt;Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder could anyone provide some guidance for the following query, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset for 10,000 households on income.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to see the impact of an increase in income of ranging between 500-1000 for a random 200 households can have on headline figures such as the percentage of the sample at risk of poverty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would anyone know how the best way to write a command to increase a variable between 500-1000 for a random 200 observations?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be most welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sean&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 11:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453147#M29225</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2018-04-11T11:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Increase values for random number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453155#M29226</link>
      <description>&lt;P&gt;Well, you can use the random number generator:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2011/08/24/how-to-generate-random-numbers-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2011/08/24/how-to-generate-random-numbers-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data A;
call streaminit(123);       /* set random number seed */
do i = 1 to 200;
   u = rand("Uniform") * 10000;     
   output;
end;
run;&lt;/PRE&gt;
&lt;P&gt;This would give you 200 random observation numbers.&amp;nbsp; Merge this to your data based on u=_nobs_ (will need an actual variable), then apply an if - note that this is just pseudocode, I haven't time to test anything right now:&lt;/P&gt;
&lt;PRE&gt;data want;
  merge have (in=a) a (in=b);&lt;BR /&gt;  by u;&lt;BR /&gt;  if b then do;&lt;BR /&gt;    /* set addition here */&lt;BR /&gt;  end;&lt;BR /&gt;run;&lt;BR /&gt;  &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 12:16:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453155#M29226</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-11T12:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Increase values for random number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453172#M29227</link>
      <description>&lt;P&gt;This can be done in 1 step, but the statistical theory proving that this is in fact a random selection is complex.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have nobs=denominator;&lt;/P&gt;
&lt;P&gt;retain numerator 200;&lt;/P&gt;
&lt;P&gt;if ranuni(12345) &amp;lt; numerator / denominator then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;value = value + 500;&amp;nbsp; /* how do you know how much to add?? */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;numerator = numerator - 1;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;denominator = denominator - 1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 12:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453172#M29227</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-11T12:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Increase values for random number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453208#M29228</link>
      <description>&lt;P&gt;Rick Wicklin discusses using random number generators in a number of places. Here's an SGF paper that discusses the topic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/scsug/2016/SAS-Ten-Tips.pdf" target="_self"&gt;https://www.lexjansen.com/scsug/2016/SAS-Ten-Tips.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 13:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Increase-values-for-random-number-of-observations/m-p/453208#M29228</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-04-11T13:44:56Z</dc:date>
    </item>
  </channel>
</rss>

