<?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: About random number &amp;quot;ranuni&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706240#M216747</link>
    <description>&lt;P&gt;Do you want to simulate a general random number or an integer?&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2020 08:19:43 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-12-16T08:19:43Z</dc:date>
    <item>
      <title>About random number "ranuni"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706235#M216743</link>
      <description>&lt;P&gt;Good afternoon fellow SAS users and the overall SAS community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to random select then nember 1~100.&lt;/P&gt;&lt;P&gt;What is the different&amp;nbsp;&lt;/P&gt;&lt;P&gt;y1=1+99*ranuni(seed);&lt;/P&gt;&lt;P&gt;y2=100*ranuni(seed);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 08:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706235#M216743</guid>
      <dc:creator>yuwentaiwan</dc:creator>
      <dc:date>2020-12-16T08:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: About random number "ranuni"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706239#M216746</link>
      <description>&lt;P&gt;When you use&lt;/P&gt;
&lt;P&gt;1+99*ranuni(seed)&lt;/P&gt;
&lt;P&gt;Then the minimum value will be no less than 1.&lt;/P&gt;
&lt;P&gt;When you use&lt;/P&gt;
&lt;P&gt;100*ranuni(seed);&lt;/P&gt;
&lt;P&gt;you may have a minimum like 100* 0.00000001.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know what you mean by "select then nember 1~100" but if your goal is to generate random integers from 1 to 100 then use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;rand('integer',100);&lt;/P&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>Wed, 16 Dec 2020 08:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706239#M216746</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-16T08:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: About random number "ranuni"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706240#M216747</link>
      <description>&lt;P&gt;Do you want to simulate a general random number or an integer?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 08:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706240#M216747</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-12-16T08:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: About random number "ranuni"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706241#M216748</link>
      <description>&lt;P&gt;I want to&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;simulate a general random number,thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 08:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706241#M216748</guid>
      <dc:creator>yuwentaiwan</dc:creator>
      <dc:date>2020-12-16T08:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: About random number "ranuni"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706242#M216749</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;r = rand('Integer', 1, 100);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Dec 2020 08:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706242#M216749</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-12-16T08:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: About random number "ranuni"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706244#M216751</link>
      <description>&lt;P&gt;I would use the more advanced random number generator, with the RAND function. RANUNI is relatively primitive - it generates a sequence of 2^32 integers (the seed value), which then repeats, and the integer values are all unique within the sequence. For your actual purpose it may be good enough, but make a habit of using the more advanced function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no SEED parameter in RAND, but you can initialize the random number stream with a call to STREAMINIT, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  call streaminit(253252); /* the seed initialization */
  n1=rand('UNIFORM',1,100); /* corresponds to 1+99*ranuni(seed), values between 1 and 100 */
  n2=rand('UNIFORM',100); /* corresponds to 100*ranuni(seed), values between 0 and 100 */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Dec 2020 08:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-random-number-quot-ranuni-quot/m-p/706244#M216751</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-12-16T08:38:55Z</dc:date>
    </item>
  </channel>
</rss>

