<?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: weighted random selection in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848150#M335331</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No time to write an example (on simulated data) for you right now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you need :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;PROC SURVEYSELECT&lt;/LI&gt;
&lt;LI&gt;with STRATA statement&lt;/LI&gt;
&lt;LI&gt;with&amp;nbsp;&lt;A tabindex="0" href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_surveyselect_syntax07.htm#statug.surveyselect.allocdata" target="_blank"&gt;ALLOC=&lt;SPAN class=" aa-argument"&gt;SAS-data-set&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;option.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;See here :&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_surveyselect_details20.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_surveyselect_details20.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2022 16:15:45 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2022-12-06T16:15:45Z</dc:date>
    <item>
      <title>weighted random selection</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/847741#M335158</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to extract a sample&amp;nbsp; with these fields: patient_id, Size of nodule (3 classes) and diagnostic (cancer or benign)&amp;nbsp; from population of 1731 patients.&lt;/P&gt;&lt;P&gt;The sample will be done without replacement and i need to have this distribution in final sample for :&lt;/P&gt;&lt;P&gt;size of nodule:&lt;/P&gt;&lt;P&gt;01:[4-10mm] =&amp;gt; 37.5%&lt;/P&gt;&lt;P&gt;02:[10-20mm] =&amp;gt; 37.5%&lt;/P&gt;&lt;P&gt;03:[20-30mm] =&amp;gt; 25%&lt;/P&gt;&lt;P&gt;Diagnostic:&lt;/P&gt;&lt;P&gt;Cancer =&amp;gt; 33.33%&lt;/P&gt;&lt;P&gt;Benign =&amp;gt; 66.67%&lt;/P&gt;&lt;P&gt;The final sample will include 200 patients.&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 08:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/847741#M335158</guid>
      <dc:creator>PSIOT2</dc:creator>
      <dc:date>2022-12-05T08:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: weighted random selection</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848150#M335331</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No time to write an example (on simulated data) for you right now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you need :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;PROC SURVEYSELECT&lt;/LI&gt;
&lt;LI&gt;with STRATA statement&lt;/LI&gt;
&lt;LI&gt;with&amp;nbsp;&lt;A tabindex="0" href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_surveyselect_syntax07.htm#statug.surveyselect.allocdata" target="_blank"&gt;ALLOC=&lt;SPAN class=" aa-argument"&gt;SAS-data-set&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;option.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;See here :&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_surveyselect_details20.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_surveyselect_details20.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 16:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848150#M335331</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-12-06T16:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: weighted random selection</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848243#M335356</link>
      <description>&lt;P&gt;&lt;SPAN&gt;To extract a sample in SAS, you can use the &lt;/SPAN&gt;&lt;CODE&gt;SAMPLE&lt;/CODE&gt;&lt;SPAN&gt; statement in a &lt;/SPAN&gt;&lt;CODE&gt;PROC SURVEYSELECT&lt;/CODE&gt;&lt;SPAN&gt; procedure. Here is an example of how you might use it to extract your sample:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SURVEYSELECT 
    SAMPLE=200
    SEED=12345 
    OUT=sample_data
    METHOD=SRS
    NOPRINT;
    STRATA SizeOfNodule
        (01: 0.375, 02: 0.375, 03: 0.25)
        DIAGNOSTIC
        (Cancer: 0.3333, Benign: 0.6667);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will create a new dataset called &lt;CODE&gt;sample_data&lt;/CODE&gt; that contains a sample of 200 patients, with the proportions of nodule sizes and diagnostic outcomes that you specified.&lt;/P&gt;
&lt;P&gt;The &lt;CODE&gt;SEED&lt;/CODE&gt; option allows you to specify a seed value for the random number generator, so that you can obtain the same sample each time you run the code. You can change the seed value to any integer that you like.&lt;/P&gt;
&lt;P&gt;The &lt;CODE&gt;METHOD=SRS&lt;/CODE&gt; option specifies that the sample will be selected using simple random sampling without replacement. This means that each patient has an equal probability of being selected, and that each patient can only be selected once.&lt;/P&gt;
&lt;P&gt;The &lt;CODE&gt;STRATA&lt;/CODE&gt; statement allows you to specify the proportions of the sample that should be allocated to each combination of nodule size and diagnostic outcome. In this case, the sample will be stratified by nodule size and diagnostic outcome, with the proportions that you specified for each stratum.&lt;/P&gt;
&lt;P&gt;I hope this helps! Let me know if you have any other questions.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 07 Dec 2022 00:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848243#M335356</guid>
      <dc:creator>webart999ARM</dc:creator>
      <dc:date>2022-12-07T00:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: weighted random selection</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848514#M335461</link>
      <description>&lt;P&gt;Thank you for your answers,&lt;/P&gt;&lt;P&gt;I tried this one but some errors appear:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SURVEYSELECT&lt;BR /&gt;N=200&lt;BR /&gt;SEED=12345&lt;BR /&gt;OUT=sample_data&lt;BR /&gt;METHOD=SRS&lt;BR /&gt;NOPRINT;&lt;BR /&gt;STRATA strateDiam3&lt;BR /&gt;(Min: 0.375, Mid: 0.375, Max: 0.25)&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, DESCENDING, NOTSORTED, _ALL_, _CHARACTER_, _CHAR_,&lt;BR /&gt;_NUMERIC_.&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FinalDiagnosis&lt;/P&gt;&lt;P&gt;(Cancer: 0.3333, Benign: 0.6667);&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 11:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weighted-random-selection/m-p/848514#M335461</guid>
      <dc:creator>PSIOT2</dc:creator>
      <dc:date>2022-12-08T11:35:02Z</dc:date>
    </item>
  </channel>
</rss>

