<?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: Insert a filter on the random sample PROC in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676864#M36733</link>
    <description>I think you can do it piecemeal sort of?&lt;BR /&gt;Do a manual freq to get your samp size and pass that to the SURVEYSELECT? It can take a data set so you filter the data set for PROC FREQ using N rows and filter the survey selection data set with a where clause for the S data sets?&lt;BR /&gt;&lt;BR /&gt;I think that would work....</description>
    <pubDate>Fri, 14 Aug 2020 19:53:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-08-14T19:53:44Z</dc:date>
    <item>
      <title>Insert a filter on the random sample PROC</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676863#M36732</link>
      <description>&lt;P&gt;Hi, everyone!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make a change on the PROC SURVEYSELECT so the results are based on filters of the source table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've attached a sample of my data. The rules are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Sample of 10% stratified by idAction&lt;/LI&gt;
&lt;LI&gt;The 10% of each idAction have to be defined by the number of rows with control = 'N'&lt;/LI&gt;
&lt;LI&gt;The random output have to be only rows with control = 'S'&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Is there a way to do this on the procedure? Or should I use another one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 19:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676863#M36732</guid>
      <dc:creator>Renan_Crepaldi</dc:creator>
      <dc:date>2020-08-14T19:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a filter on the random sample PROC</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676864#M36733</link>
      <description>I think you can do it piecemeal sort of?&lt;BR /&gt;Do a manual freq to get your samp size and pass that to the SURVEYSELECT? It can take a data set so you filter the data set for PROC FREQ using N rows and filter the survey selection data set with a where clause for the S data sets?&lt;BR /&gt;&lt;BR /&gt;I think that would work....</description>
      <pubDate>Fri, 14 Aug 2020 19:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676864#M36733</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-14T19:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a filter on the random sample PROC</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676865#M36734</link>
      <description>&lt;P&gt;So people have an idea what the "data" looks like:&lt;/P&gt;
&lt;PRE&gt;idAction;control;idClient
28004;N;40045
28004;N;40311
28004;N;40404
28004;N;35386
28004;N;162426
28004;N;163213
28004;S;149327
28004;S;163481
28004;N;163645
28004;N;149653
28004;N;157771
28004;N;303829
28004;N;304119
28004;S;290727
28004;S;286589
28004;N;304922
28004;S;286922
28004;N;292085
28004;S;450891
28004;S;506107&lt;/PRE&gt;
&lt;P&gt;Now,&lt;/P&gt;
&lt;P&gt;What does this mean?&lt;/P&gt;
&lt;PRE&gt;The 10% of each idAction have to be defined by the number of rows with control = 'N'
The random output have to be only rows with control = 'S'&lt;/PRE&gt;
&lt;P&gt;If the output only consists of records where control=S then I do not understand how "10% of each idAction have to be defined by the number of rows with control='N'.&lt;/P&gt;
&lt;P&gt;Please describe in much more detail how the control = 'N' records are actually used. LOTS more detail.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 19:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676865#M36734</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-14T19:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a filter on the random sample PROC</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676869#M36736</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;! Thanks for replying!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I think you've got the idea, but to clarify more, here are some more details:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The clients marked with control = N are the ones targeted, and the sample must be created based on its total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the other hand, control = S are my control group, which need to be 10% of the targeted group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's why I need to "cross" these proportions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if I've made myself clear (English isn't my native languague), but I'm available to give anymore informations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 20:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676869#M36736</guid>
      <dc:creator>Renan_Crepaldi</dc:creator>
      <dc:date>2020-08-14T20:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a filter on the random sample PROC</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676871#M36737</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',';
input idAction $ control $ idClient $ ;
datalines;
28004,N,40045
28004,N,40311
28004,N,40404
28004,N,35386
28004,N,162426
28004,N,163213
28004,S,149327
28004,S,163481
28004,N,163645
28004,N,149653
28004,N,157771
28004,N,303829
28004,N,304119
28004,S,290727
28004,S,286589
28004,N,304922
28004,S,286922
28004,N,292085
28004,S,450891
28004,S,506107
;;;;
run;

proc freq data=have;
where control = 'N';
table idAction / out=counts;
run;

data sampSizeSpecifications;
set counts;
_nsize_ = ceil(0.1*Count);
run;

proc surveyselect data=have method = srs sampsize = sampSizeSpecifications out=selected;
where control = 'S';
strata idAction;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Are you sure you don't want PROC PSMATCH and case control matching?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 20:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/676871#M36737</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-14T20:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Insert a filter on the random sample PROC</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/677353#M36764</link>
      <description>&lt;P&gt;Thank you very much,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About your observation of using the PROC PSMATCH, I'll use a method to pair the groups after, so I won't need this right now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nonetheless, thanks for the advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards, Renan.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 21:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-a-filter-on-the-random-sample-PROC/m-p/677353#M36764</guid>
      <dc:creator>Renan_Crepaldi</dc:creator>
      <dc:date>2020-08-17T21:20:49Z</dc:date>
    </item>
  </channel>
</rss>

