<?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: Stratified random sample by group with count conditions (and possibly weighting) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378422#M90917</link>
    <description>&lt;P&gt;Post some data here. Not excel. No one would like to download it from websit.&lt;/P&gt;
&lt;P&gt;And don't forget post your output either.&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jul 2017 14:59:07 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-07-22T14:59:07Z</dc:date>
    <item>
      <title>Stratified random sample by group with count conditions (and possibly weighting)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378139#M90840</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a complicated sampling strategy that I am trying to program in SAS 9.4 and am hoping someone can help me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My dataset of ~150,000 includes patients at 1230 facilities that received two types of treatment.&amp;nbsp; ~4000 received treatment A while ~146,000 received treatment B.&amp;nbsp; I need to generate a dataset with no more than 15 patients selected from each facility, but keep as many of the 4000 A patients as I can.&amp;nbsp; So for example if a facility had 5 A patients I would keep all 5 A patients then draw a random sample of 10 B patients from that facility to get n=15.&amp;nbsp; If there are no A patients at the facility then I would take a random sample of 15 B patients, likewise if there are 15 A patients at the facility I would keep all 15 of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a few facilities where there are more than 15 A patients, so I would need to draw a random sample of 15 A patients for these facilities.&amp;nbsp; I would then lose a few A patients from my overall sample.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because the number of patients A+B from each facility ranges from 0 to &amp;gt;1000, I don't know if I can use PPS or weighting in this algorithm or if I will need to adjust for sampling weights in my analysis later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached a small sample dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Laura&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 13:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378139#M90840</guid>
      <dc:creator>hendrixl114</dc:creator>
      <dc:date>2017-07-21T13:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Stratified random sample by group with count conditions (and possibly weighting)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378143#M90844</link>
      <description>&lt;P&gt;Have you already attempted to use SURVEYSELECT for this sampling, or do you not know about that procedure?&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_surveyselect_examples02.htm" target="_self"&gt;The doc includes an example of PPS stratified sampling.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 13:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378143#M90844</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-07-21T13:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Stratified random sample by group with count conditions (and possibly weighting)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378160#M90849</link>
      <description>&lt;P&gt;I have used surveyselect, but I need a way to draw all of the As for each facility before sampling the Bs.&amp;nbsp; If I remove the A first from the dataset I need to be able to select only 15-A patients from each facility.&amp;nbsp; I think i need some sort of macro that will cycle through the observations at each faciity and apply the conditions, but I don't know how to do this.&amp;nbsp; I'm actually not as worried about the PPS as getting the correct number of A and B per facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 14:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378160#M90849</guid>
      <dc:creator>hendrixl114</dc:creator>
      <dc:date>2017-07-21T14:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Stratified random sample by group with count conditions (and possibly weighting)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378422#M90917</link>
      <description>&lt;P&gt;Post some data here. Not excel. No one would like to download it from websit.&lt;/P&gt;
&lt;P&gt;And don't forget post your output either.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2017 14:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stratified-random-sample-by-group-with-count-conditions-and/m-p/378422#M90917</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-22T14:59:07Z</dc:date>
    </item>
  </channel>
</rss>

