<?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 find compare group for treatment group with SAS in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275191#M7704</link>
    <description>Thank you so much ballardw, I got your idea, that's very similar to my need. Cheers, Owen</description>
    <pubDate>Sat, 04 Jun 2016 17:05:40 GMT</pubDate>
    <dc:creator>owen_black</dc:creator>
    <dc:date>2016-06-04T17:05:40Z</dc:date>
    <item>
      <title>How to find compare group for treatment group with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275037#M7695</link>
      <description>Hi, I have a treatment group of about 2000 firms and their financial data, and comparable data for about a million other firms. Anyone could tell me how could I find firms to build the compare group? Could you kindly tell me where I could find examples of sas code to do the job? Thanks a lot! Cheer, Owen</description>
      <pubDate>Fri, 03 Jun 2016 17:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275037#M7695</guid>
      <dc:creator>owen_black</dc:creator>
      <dc:date>2016-06-03T17:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to find compare group for treatment group with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275070#M7696</link>
      <description>&lt;P&gt;How do you want to compare them? From your question only, it could be on the first letter of their name &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275070#M7696</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-03T18:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find compare group for treatment group with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275131#M7700</link>
      <description>&lt;P&gt;Without knowing details of what you might consider a "match", here is a very generic way.&lt;/P&gt;
&lt;P&gt;The first two datasets just build some dummy data with a name and value. The Proc sql compares the sales values (assumes that is what you want to match on, not much else in this data) and selects matches when the difference is 300 or less. Depending on the number of matches you might want you would adjust the value of that comparison parameter up or down.&lt;/P&gt;
&lt;P&gt;If you only want the compare company to "match" one in the treatment set it will be up to you to remove the duplicates which would not be very difficult (left as an exercise for the interested reader).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you multiple values to match on describing the space could be a simple as adding AND for the different variables.&lt;/P&gt;
&lt;P&gt;Refinements but I'm too lazy to try to code today would be to identify the minimum absolute difference and only select the compare companies with that value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not making ANY claim to efficiency in the code. Simple and brute force. Careful consideration of the differences at first step may help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data treat;
   input name $ sales;
datalines;
abc   10000
cdf   20000
ged   30000
;
run;

data compare;
   length compname $ 8;
   do a='S','T','U','V','X','Y','Z';
      do b='S','T','U','V','X','Y','Z';
         do c='S','T','U','V','X','Y','Z';
            do d='S','T','U','V','X','Y','Z';
           
               compname=catt(a,b,c,d);
               compsales = round(100000*rand('uniform'),100);
               output;
            end;
         end;
      end;
   end;
   drop a b c;
run;


proc sql;
   create table compgroup as
   select a.*,b.*
   from treat as a, compare as b
   where abs(a.sales-b.compsales) &amp;lt; 300;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A real rough other approach would be to combine the two data sets with a variable that contains which set each record comes from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sort on the comparison values.&lt;/P&gt;
&lt;P&gt;Extract the treatment records and the one or two following the treatment record (very easy) and possibly one or two preceding ( a litle more work).&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 22:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275131#M7700</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-03T22:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to find compare group for treatment group with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275191#M7704</link>
      <description>Thank you so much ballardw, I got your idea, that's very similar to my need. Cheers, Owen</description>
      <pubDate>Sat, 04 Jun 2016 17:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-compare-group-for-treatment-group-with-SAS/m-p/275191#M7704</guid>
      <dc:creator>owen_black</dc:creator>
      <dc:date>2016-06-04T17:05:40Z</dc:date>
    </item>
  </channel>
</rss>

