<?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: Proc Survey Select - Stratified Random Sampling in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/482017#M71639</link>
    <description>&lt;P&gt;Thank you very much. I really appreciate it.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 19:46:35 GMT</pubDate>
    <dc:creator>Jeff_DOC</dc:creator>
    <dc:date>2018-07-27T19:46:35Z</dc:date>
    <item>
      <title>Proc Survey Select - Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/441431#M69254</link>
      <description>&lt;P&gt;Good afternoon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm hoping someone out there can help me with proc surveyselect. I have a dataset of multiple locations and within each location are multiple caseloads. What I need is to randomly select 1 case from each caseload to a maximum selection of 11 per audit location. If there are more caseloads than 11 in the audit location I just want a random selection of 11 even if that means not selecting a case from one caseload. If there are less than 11 caseloads for a location I need as many cases from each caseload to get to 11. I've read the documentation and read over the boards and some answers can just about get me there but not quite.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using Enterprise Guide version 7.15 HF2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for any help you can provide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's one of the many iterations I've tried and a file attachment for practice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;surveyselect&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = have01&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;stats&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;n&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = want01&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;sampsize&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;11&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;selectall&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* method=sys*/&lt;/P&gt;
&lt;P&gt;/* n=11;*/&lt;/P&gt;
&lt;P&gt;/* control caseload;*/&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;strata&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; audit_location caseload ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 00:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/441431#M69254</guid>
      <dc:creator>Jeff_DOC</dc:creator>
      <dc:date>2018-03-02T00:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Select - Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/481887#M71623</link>
      <description>&lt;P&gt;Here's a data step solution.&amp;nbsp;The first sort and original_order variable are just to demonstrate that it's randomly sampling. First, add a random number to each record. Then sort by audit location and the random order. The second data step will keep the first 11 of that random number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sort data=example_1;&lt;BR /&gt; by audit_location;&lt;BR /&gt;data sample;&lt;BR /&gt; set example_1;&lt;BR /&gt; by audit_location;&lt;BR /&gt; if first.audit_location=1 then original_order=1;&lt;BR /&gt; else original_order+1;&lt;BR /&gt; random=ranuni(12345);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sort data=sample;&lt;BR /&gt; by audit_location random;&lt;BR /&gt;data sample2;&lt;BR /&gt; set sample;&lt;BR /&gt; by audit_location;&lt;BR /&gt; if first.audit_location=1 then sample_count=1;&lt;BR /&gt; else sample_count+1;&lt;BR /&gt; if sample_count gt 11 then delete;&lt;BR /&gt;run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 15:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/481887#M71623</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2018-07-27T15:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Survey Select - Stratified Random Sampling</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/482017#M71639</link>
      <description>&lt;P&gt;Thank you very much. I really appreciate it.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Survey-Select-Stratified-Random-Sampling/m-p/482017#M71639</guid>
      <dc:creator>Jeff_DOC</dc:creator>
      <dc:date>2018-07-27T19:46:35Z</dc:date>
    </item>
  </channel>
</rss>

