<?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: random numbers generation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59580#M12915</link>
    <description>go the answer:&lt;BR /&gt;
&lt;BR /&gt;
%macro a(a,b,c);&lt;BR /&gt;
Data qwe;&lt;BR /&gt;
Do i=1 to &amp;amp;c;&lt;BR /&gt;
Count= ceil(ranuni(0)*(&amp;amp;b-&amp;amp;a))+&amp;amp;a;&lt;BR /&gt;
Output;&lt;BR /&gt;
End;&lt;BR /&gt;
Run;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%a(23,64,200);</description>
    <pubDate>Wed, 05 Nov 2008 14:04:15 GMT</pubDate>
    <dc:creator>Pavan_SAS</dc:creator>
    <dc:date>2008-11-05T14:04:15Z</dc:date>
    <item>
      <title>random numbers generation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59579#M12914</link>
      <description>hi all,&lt;BR /&gt;
&lt;BR /&gt;
How we can generate random numbers between a specified range?&lt;BR /&gt;
Ex: I want to create count=23 to 64 randomly in a dataset which contains 200 observation. How?&lt;BR /&gt;
It should be generic. Means write with macros. Just user need to give start, end values. &lt;BR /&gt;
&lt;BR /&gt;
I tried like this:&lt;BR /&gt;
Count=ceil(ranuni(0)*42)+22;&lt;BR /&gt;
&lt;BR /&gt;
This is correct for that range only !&lt;BR /&gt;
&lt;BR /&gt;
If range is changed, we need to change the code.&lt;BR /&gt;
&lt;BR /&gt;
I want this with macro code, so that it will generate required range only !&lt;BR /&gt;
&lt;BR /&gt;
Example code…&lt;BR /&gt;
&lt;BR /&gt;
%macro a;&lt;BR /&gt;
Data qwe;&lt;BR /&gt;
Do i=1 to 200;&lt;BR /&gt;
Count= --------------- -?      --&amp;gt; fill this statement.&lt;BR /&gt;
Output;&lt;BR /&gt;
End;&lt;BR /&gt;
Run;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%a(start=23,end=64);</description>
      <pubDate>Wed, 05 Nov 2008 13:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59579#M12914</guid>
      <dc:creator>Pavan_SAS</dc:creator>
      <dc:date>2008-11-05T13:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: random numbers generation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59580#M12915</link>
      <description>go the answer:&lt;BR /&gt;
&lt;BR /&gt;
%macro a(a,b,c);&lt;BR /&gt;
Data qwe;&lt;BR /&gt;
Do i=1 to &amp;amp;c;&lt;BR /&gt;
Count= ceil(ranuni(0)*(&amp;amp;b-&amp;amp;a))+&amp;amp;a;&lt;BR /&gt;
Output;&lt;BR /&gt;
End;&lt;BR /&gt;
Run;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%a(23,64,200);</description>
      <pubDate>Wed, 05 Nov 2008 14:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59580#M12915</guid>
      <dc:creator>Pavan_SAS</dc:creator>
      <dc:date>2008-11-05T14:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: random numbers generation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59581#M12916</link>
      <description>Count= ceil(ranuni(0)*(&amp;amp;b-&amp;amp;a+1))+(&amp;amp;a-1);</description>
      <pubDate>Wed, 05 Nov 2008 14:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-numbers-generation/m-p/59581#M12916</guid>
      <dc:creator>Pavan_SAS</dc:creator>
      <dc:date>2008-11-05T14:15:53Z</dc:date>
    </item>
  </channel>
</rss>

