<?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: re: PROC SURVEYSELECT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268805#M53245</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4061"&gt;@twildone﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason for the number of clients being less than the specified sample size is that you used unrestricted random sampling (URS), which implies sampling &lt;EM&gt;with replacement&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think, you should follow a two-stage approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Stage 1: Select all records of 25 randomly selected clients (simple random sampling of clients) */

proc surveyselect data=summary94 n=25 seed=31415 out=stage1;
samplingunit client_id;
run;

/* Stage 2: Select one record per client (simple random sampling of records, stratified by client) */

proc surveyselect data=stage1 n=1 seed=27182 out=hsbs(drop=SelectionProb SamplingWeight);
strata client_id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Edit: Dropped variables SelectionProb and SamplingWeight from output dataset assuming these are not needed.)&lt;/P&gt;</description>
    <pubDate>Fri, 06 May 2016 14:42:49 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2016-05-06T14:42:49Z</dc:date>
    <item>
      <title>re: PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268784#M53240</link>
      <description>&lt;P&gt;Hi...I am trying to select 25 clients with 1 record for each client. Each client will have more than 1 record. When I run the code below, I end up with only 23 clients but when I change the samplesize from 25 to 27, I end up with 25 clients which is what I wanted. Any suggestions how to correct this.....Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;surveyselect&lt;/STRONG&gt; data = SUMMARY94 method = URS rep = &lt;STRONG&gt;1&lt;/STRONG&gt; sampsize = &lt;STRONG&gt;25&lt;/STRONG&gt; seed = &lt;STRONG&gt;12345&lt;/STRONG&gt; out = hsbs3;&lt;/P&gt;
&lt;P&gt;id _ALL_;&lt;/P&gt;
&lt;P&gt;SAMPLINGUNIT CLIENT_ID;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; hsbs2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET hsbs3;&lt;/P&gt;
&lt;P&gt;do sampleUnitID=&lt;STRONG&gt;1&lt;/STRONG&gt; to numberhits;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt; &lt;STRONG&gt;SORT&lt;/STRONG&gt; DATA=hsbs2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY REPLICATE CLIENT_ID SAMPLEUNITID;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; hsbs1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET hsbs2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY REPLICATE CLIENT_ID SAMPLEUNITID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF FIRST.REPLICATE THEN SAMPLEID=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF FIRST.SAMPLEUNITID THEN SAMPLEID+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 13:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268784#M53240</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2016-05-06T13:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: re: PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268802#M53244</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=SUMMARY94;&lt;BR /&gt;by CLIENT_ID;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc surveyselect data = SUMMARY94 method = URS sampsize = 1 seed = 12345 out = hsbs3;&lt;BR /&gt;strata CLIENT_ID;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 14:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268802#M53244</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-05-06T14:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: re: PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268805#M53245</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4061"&gt;@twildone﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason for the number of clients being less than the specified sample size is that you used unrestricted random sampling (URS), which implies sampling &lt;EM&gt;with replacement&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think, you should follow a two-stage approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Stage 1: Select all records of 25 randomly selected clients (simple random sampling of clients) */

proc surveyselect data=summary94 n=25 seed=31415 out=stage1;
samplingunit client_id;
run;

/* Stage 2: Select one record per client (simple random sampling of records, stratified by client) */

proc surveyselect data=stage1 n=1 seed=27182 out=hsbs(drop=SelectionProb SamplingWeight);
strata client_id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Edit: Dropped variables SelectionProb and SamplingWeight from output dataset assuming these are not needed.)&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 14:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268805#M53245</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-06T14:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: re: PROC SURVEYSELECT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268839#M53258</link>
      <description>&lt;P&gt;Thanks....it worked perfectly!!!!!&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 16:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-PROC-SURVEYSELECT/m-p/268839#M53258</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2016-05-06T16:04:52Z</dc:date>
    </item>
  </channel>
</rss>

