<?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 perform a random selection based on percentage in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5683#M2104</link>
    <description>Anybody ???  I actually only need help with how to figure the percentage pieces.  I've looked at the samples under SAS Tech Support and through Google, but do not understand the percentage derivations.&lt;BR /&gt;
&lt;BR /&gt;
Plus, the books we have on site don't cover proc surveyselect....the books are too old.&lt;BR /&gt;
&lt;BR /&gt;
So, anybody?? Please??</description>
    <pubDate>Tue, 27 Nov 2007 14:41:58 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-11-27T14:41:58Z</dc:date>
    <item>
      <title>How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5682#M2103</link>
      <description>I'm creating a stored process which will produce a report of employees chosen at random, based on selected percentages.  However, I am not sure of how to do this in Ent. Guide!  Would I use something like the following:&lt;BR /&gt;
&lt;BR /&gt;
proc surveyselect data=HMASelect &lt;BR /&gt;
n=25;&lt;BR /&gt;
method=srs &lt;BR /&gt;
out=HSW; &lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
However, I don't want to hard-code the n=25; above....I want to be able to process my entire table.&lt;BR /&gt;
&lt;BR /&gt;
Also, in the same program, I need to select a certain percentage of administrators, a certain percentage of staff and a certain percentage of classified employees.  In short.... say 25 % of admin, 50% of staff and the remainder to be 25%.  Then, for example, in the 25% of admin, to randomly select admin, and so on.&lt;BR /&gt;
&lt;BR /&gt;
If someone can please help, I would appreciate it.  Thank you, and I look forward to your replies!</description>
      <pubDate>Mon, 26 Nov 2007 16:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5682#M2103</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-26T16:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5683#M2104</link>
      <description>Anybody ???  I actually only need help with how to figure the percentage pieces.  I've looked at the samples under SAS Tech Support and through Google, but do not understand the percentage derivations.&lt;BR /&gt;
&lt;BR /&gt;
Plus, the books we have on site don't cover proc surveyselect....the books are too old.&lt;BR /&gt;
&lt;BR /&gt;
So, anybody?? Please??</description>
      <pubDate>Tue, 27 Nov 2007 14:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5683#M2104</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-27T14:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5684#M2105</link>
      <description>Hi,&lt;BR /&gt;
  I was a Lit major and now I'm a report geek (and teacher). I don't use PROC SURVEYSELECT. Your best bet for help using PROC SURVEYSELECT is to contact Tech Support.&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 27 Nov 2007 15:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5684#M2105</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-11-27T15:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5685#M2106</link>
      <description>"Plus, the books we have on site don't cover proc surveyselect....the books are too old."&lt;BR /&gt;
&lt;BR /&gt;
Try&lt;BR /&gt;
&lt;A href="http://support.sas.com/onlinedoc/913/docMainpage.jsp" target="_blank"&gt;http://support.sas.com/onlinedoc/913/docMainpage.jsp&lt;/A&gt;</description>
      <pubDate>Tue, 27 Nov 2007 17:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5685#M2106</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2007-11-27T17:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5686#M2107</link>
      <description>Thanks for the link....I'll check it out.</description>
      <pubDate>Tue, 27 Nov 2007 22:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5686#M2107</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-27T22:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5687#M2108</link>
      <description>Try the SAMPRATE=0.25 instead of the N option.&lt;BR /&gt;
This will draw you a sample which size is one fourth of the total dataset.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Olivier</description>
      <pubDate>Wed, 28 Nov 2007 14:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5687#M2108</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-11-28T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5688#M2109</link>
      <description>Oliver,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for replying, however, I need to process my whole dataset, as mentioned in my initial note:&lt;BR /&gt;
&lt;BR /&gt;
"However, I don't want to hard-code the n=25; above....I want to be able to process my entire table.&lt;BR /&gt;
&lt;BR /&gt;
Also, in the same program, I need to select a certain percentage of administrators, a certain percentage of staff and a certain percentage of classified employees. In short.... say 25 % of admin, 50% of staff and the remainder to be 25%. Then, for example, in the 25% of admin, to randomly select admin, and so on."&lt;BR /&gt;
&lt;BR /&gt;
I do however appreciate your responding.  If I misunderstand your reply, please accept my apology.</description>
      <pubDate>Thu, 29 Nov 2007 15:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5688#M2109</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-29T15:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5689#M2110</link>
      <description>Hi:&lt;BR /&gt;
  According to the SURVEYSELECT doc, you can&lt;BR /&gt;
"....can perform stratified sampling, selecting samples independently within the specified strata, or nonoverlapping subgroups of the survey population. "&lt;BR /&gt;
 &lt;BR /&gt;
 If reading the documentation doesn't help, then you may want to search for papers about PROC SURVEYSELECT. Or, if your data are not survey-based, you may wish to investigate other techniques to randomly select observations. Tech Support can help you figure out the best technique to use.&lt;BR /&gt;
&lt;BR /&gt;
To send a question to Tech Support, go to &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; and in the left-hand navigation pane, click on the link entitled "Submit a Problem". &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 29 Nov 2007 16:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5689#M2110</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-11-29T16:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5690#M2111</link>
      <description>Hi SASMan.&lt;BR /&gt;
&lt;BR /&gt;
It's just me being stupid : I misread your problem. Now that you explain (twice), I think I understand.&lt;BR /&gt;
You can use the SAMPRATE option pointing on a dataset containing the percentage (in a variable that MUST be named _RATE_) of each subgroup you want to draw samples from.&lt;BR /&gt;
In your exemple, that would lead to :&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC SORT DATA = yourData OUT = work.categories NODUPKEY ;&lt;BR /&gt;
  BY status ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
DATA work.categories ;&lt;BR /&gt;
   SET work.categories (KEEP = status) ;&lt;BR /&gt;
   IF status = "Admin" THEN _rate_ = .25 ;&lt;BR /&gt;
   ELSE _rate_ = .50 ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
PROC SURVEYSELECT DATA = yourData OUT = yourSelection&lt;BR /&gt;
                                    METHOD = SRS NOPRINT&lt;BR /&gt;
                                    SAMPRATE = work.categories ;&lt;BR /&gt;
   STRATA status ; /* your dataset must be sorted by STATUS */&lt;BR /&gt;
RUN ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
I hope that this time I am delivering interesting information. If not, please feel free to ask again -- in the end I may understand something &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Olivier</description>
      <pubDate>Thu, 29 Nov 2007 19:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5690#M2111</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-11-29T19:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a random selection based on percentage</title>
      <link>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5691#M2112</link>
      <description>Olivier,&lt;BR /&gt;
&lt;BR /&gt;
Actually, that looks quite like what I'm thinking of!  I'lltake a crack at modifying your code suggestion and see what comes out the other end.&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much!  I'll let you know.....</description>
      <pubDate>Thu, 29 Nov 2007 20:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-perform-a-random-selection-based-on-percentage/m-p/5691#M2112</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-29T20:35:49Z</dc:date>
    </item>
  </channel>
</rss>

