<?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 draws without replacement in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111181#M841</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many ways. Do you have SAS/IML 12.1 (SAS 9.3m2)? If so, use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s = sample(1:60, {15 100}, "WOR");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample space is 1:60.&amp;nbsp; The sample size is 15.&amp;nbsp; The number of independent draws is 100. The samplnig is done without replacement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Aug 2013 19:11:20 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2013-08-14T19:11:20Z</dc:date>
    <item>
      <title>Random draws without replacement</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111180#M840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to randomly choose k integers between 1 and T &lt;EM&gt;without&lt;/EM&gt; replacement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what I've come up with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;T=60;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;k=15;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/* random vector for choosing integers */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;r = j(T,1,0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;call randgen(r,'uniform');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/* find indices from sorting r */&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;call sortndx( integers, r, {1});&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/* take first k integers */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;draw = &lt;SPAN style="font-family: 'courier new', courier;"&gt;integers&lt;/SPAN&gt;[1:k];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do it many times, and I'd rather avoid looping through this, so I'm wondering if anyone has a better solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 19:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111180#M840</guid>
      <dc:creator>stoffprof</dc:creator>
      <dc:date>2013-08-14T19:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Random draws without replacement</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111181#M841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many ways. Do you have SAS/IML 12.1 (SAS 9.3m2)? If so, use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s = sample(1:60, {15 100}, "WOR");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample space is 1:60.&amp;nbsp; The sample size is 15.&amp;nbsp; The number of independent draws is 100. The samplnig is done without replacement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 19:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111181#M841</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-08-14T19:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Random draws without replacement</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111182#M842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perfect, thanks Rick. I made sure to update to 9.4 (12.3) after your recent blog post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 19:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Random-draws-without-replacement/m-p/111182#M842</guid>
      <dc:creator>stoffprof</dc:creator>
      <dc:date>2013-08-14T19:21:32Z</dc:date>
    </item>
  </channel>
</rss>

