<?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: %50/%50 Under Sampling Based On Bad Rate By Using Enterprise Guide And Enterprise Miner in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334473#M75535</link>
    <description>&lt;P&gt;Use proc surveyselect&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by date target; run;

proc surveyselect data=have out=samples sampsize=12;
strata date target;
id id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to oversample, i.e. get a sample size greater than the population, then do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by date target; run;

proc surveyselect data=have out=samples sampsize=12 method=urs outhits;
strata date target;
id id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 21:42:52 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-02-20T21:42:52Z</dc:date>
    <item>
      <title>%50/%50 Under Sampling Based On Bad Rate By Using Enterprise Guide And Enterprise Miner</title>
      <link>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334434#M75523</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know there are several context about this subject in internet, however, when I try to get %50/%50 bad rate sample by using SAS Code or by using Sample node on Enterprise Miner, I could not reach my aim. I try to get stratified sample &amp;nbsp;based on Target and Date variables. I found some code on internet and I also tried Sample node but I could not get 50/50 sample, I don't exactly know what values should I select when I use the Enterprise Miner Sample Node on Properties panel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used following propeties when I try to get the sample on Enterprise Miner;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7356i03DDF6247287E10E/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Desired.png" title="Desired.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the other hand, if there is code to get under sample &amp;nbsp;of data based on bad rate, I would like to learn the method to get sample by using Enterprise Guide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a sample data set as below, I want to get &amp;nbsp;12(1)/12(0) sample based on Target and Date variables, if someone can help me, I will be glad to learn these methods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
Length ID 8 Date $ 20 Variable1 8 Variable2 8 Variable3 8 Target 8;
Infile Datalines Missover ;
Input ID Date Variable1 Variable2 Variable3 Target;
Datalines;
1 20150101 100 200 300 0
1 20150201 100 200 300 1
1 20150301 100 200 300 0
2 20150101 100 200 300 1
2 20150201 100 200 300 0
2 20150301 100 200 300 0
3 20150101 100 200 300 0
3 20150201 100 200 300 0
3 20150301 100 200 300 1
4 20150101 100 200 300 0
4 20150201 100 200 300 0
4 20150301 100 200 300 1
5 20150101 100 200 300 1
5 20150201 100 200 300 0
5 20150301 100 200 300 0
6 20150101 100 200 300 0
6 20150201 100 200 300 1
6 20150301 100 200 300 0
7 20150101 100 200 300 1
7 20150201 100 200 300 0
7 20150301 100 200 300 0
8 20150101 100 200 300 0
8 20150201 100 200 300 1
8 20150301 100 200 300 0
9 20150101 100 200 300 0
9 20150201 100 200 300 0
9 20150301 100 200 300 1
10 20150101 100 200 300 0
10 20150201 100 200 300 0
10 20150301 100 200 300 1
11 20150101 100 200 300 1
11 20150201 100 200 300 0
11 20150301 100 200 300 0
12 20150101 100 200 300 0
12 20150201 100 200 300 1
12 20150301 100 200 300 0
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 19:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334434#M75523</guid>
      <dc:creator>ertr</dc:creator>
      <dc:date>2017-02-20T19:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: %50/%50 Under Sampling Based On Bad Rate By Using Enterprise Guide And Enterprise Miner</title>
      <link>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334473#M75535</link>
      <description>&lt;P&gt;Use proc surveyselect&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by date target; run;

proc surveyselect data=have out=samples sampsize=12;
strata date target;
id id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to oversample, i.e. get a sample size greater than the population, then do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by date target; run;

proc surveyselect data=have out=samples sampsize=12 method=urs outhits;
strata date target;
id id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 21:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334473#M75535</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-20T21:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: %50/%50 Under Sampling Based On Bad Rate By Using Enterprise Guide And Enterprise Miner</title>
      <link>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334611#M75583</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your first code gives following error;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The sample size, 12, is greater than the number of sampling units, 8.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: The sample size, 12, is greater than the number of sampling units, 4.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;And I don't exactly understand what your second code gives us and what Method=URS&amp;amp;Outhits do? Could you give more detail, please? I want to get a code which export 24 rows being 12 bad and 12 good based on Target&amp;amp;Date.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;And on Enterprise Miner, what should I do, to get following results?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7364iF1AE4381A768937A/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="MinerOut.png" title="MinerOut.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 10:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334611#M75583</guid>
      <dc:creator>ertr</dc:creator>
      <dc:date>2017-02-21T10:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: %50/%50 Under Sampling Based On Bad Rate By Using Enterprise Guide And Enterprise Miner</title>
      <link>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334792#M75632</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;, Any idea about this subject?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 22:00:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/334792#M75632</guid>
      <dc:creator>ertr</dc:creator>
      <dc:date>2017-02-21T22:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: %50/%50 Under Sampling Based On Bad Rate By Using Enterprise Guide And Enterprise Miner</title>
      <link>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/335847#M76068</link>
      <description>&lt;P&gt;Any suggestion about the subject?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 09:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/50-50-Under-Sampling-Based-On-Bad-Rate-By-Using-Enterprise-Guide/m-p/335847#M76068</guid>
      <dc:creator>ertr</dc:creator>
      <dc:date>2017-02-25T09:39:09Z</dc:date>
    </item>
  </channel>
</rss>

