<?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: How to assign random numbers 1, 2, 3 to subjects in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37621#M9590</link>
    <description>ranuni() gives you uniform distributed random numbers between 0 and 1.&lt;BR /&gt;
&lt;BR /&gt;
The seed is the starting point from where you start picking the random numbers out of a very very long list of numbers.&lt;BR /&gt;
&lt;BR /&gt;
If you use '0' as seed then the system time is used as seed and so the starting point is different for every execution of your code - resulting in an always different set of random numbers.&lt;BR /&gt;
&lt;BR /&gt;
To assign random numbers between 0 and 2 use the following line in a data step:&lt;BR /&gt;
&lt;BR /&gt;
RandomNumber=floor(ranuni(&lt;SEED&gt;)*3);&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;/SEED&gt;</description>
    <pubDate>Thu, 07 Jan 2010 12:09:35 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2010-01-07T12:09:35Z</dc:date>
    <item>
      <title>How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37618#M9587</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I want to assign random numbers 1, 2, 3 to subjects in a dataset. Not sure how to use RANUNI function. Please help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
/Sukanya</description>
      <pubDate>Wed, 06 Jan 2010 23:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37618#M9587</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-06T23:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37619#M9588</link>
      <description>I'm not sure I understand your question.  If you want to assign dummy treatments to a list(data set) of subjects that is easily done using the RANTBL function.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
   trt = rantbl(seed,1/3,1/3);&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
This assigns one of three values 1,2,3 with equal probability for each.  I use this technique to create dummy treatments when working to data that is still blinded.&lt;BR /&gt;
&lt;BR /&gt;
If you need something more complex like generating a plan that can be done too.</description>
      <pubDate>Thu, 07 Jan 2010 00:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37619#M9588</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-07T00:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37620#M9589</link>
      <description>Thanks for the quick reply.&lt;BR /&gt;
&lt;BR /&gt;
Sorry I want to assign 0, 1, 2. How do I do that. How does Seed value controls ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
/Sukanya</description>
      <pubDate>Thu, 07 Jan 2010 03:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37620#M9589</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-07T03:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37621#M9590</link>
      <description>ranuni() gives you uniform distributed random numbers between 0 and 1.&lt;BR /&gt;
&lt;BR /&gt;
The seed is the starting point from where you start picking the random numbers out of a very very long list of numbers.&lt;BR /&gt;
&lt;BR /&gt;
If you use '0' as seed then the system time is used as seed and so the starting point is different for every execution of your code - resulting in an always different set of random numbers.&lt;BR /&gt;
&lt;BR /&gt;
To assign random numbers between 0 and 2 use the following line in a data step:&lt;BR /&gt;
&lt;BR /&gt;
RandomNumber=floor(ranuni(&lt;SEED&gt;)*3);&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;/SEED&gt;</description>
      <pubDate>Thu, 07 Jan 2010 12:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37621#M9590</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-01-07T12:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37622#M9591</link>
      <description>&amp;gt; Thanks for the quick reply.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Sorry I want to assign 0, 1, 2. How do I do that. &lt;BR /&gt;
Subtract 1.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; How does Seed value controls ?&lt;BR /&gt;
SAS has online Help.  It will explain the SEED and how to use it better than I can.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; /Sukanya</description>
      <pubDate>Thu, 07 Jan 2010 16:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37622#M9591</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-07T16:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37623#M9592</link>
      <description>Thanks All. This really helps. Now I understand how Seed value controls.</description>
      <pubDate>Thu, 07 Jan 2010 19:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37623#M9592</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-07T19:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37624#M9593</link>
      <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
Do you just want to assign random number or want to select samples from a big population.&lt;BR /&gt;
&lt;BR /&gt;
If it is the second case use PROC SURVEYSELECT.&lt;BR /&gt;
&lt;BR /&gt;
It is pretty straight forward.&lt;BR /&gt;
&lt;BR /&gt;
Sandhya.</description>
      <pubDate>Fri, 08 Jan 2010 17:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37624#M9593</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-01-08T17:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign random numbers 1, 2, 3 to subjects</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37625#M9594</link>
      <description>No, I just want to assign the random number for each observation randomly.&lt;BR /&gt;
&lt;BR /&gt;
/Sukanya</description>
      <pubDate>Mon, 25 Jan 2010 22:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-assign-random-numbers-1-2-3-to-subjects/m-p/37625#M9594</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-25T22:23:17Z</dc:date>
    </item>
  </channel>
</rss>

