<?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: selecting good matches by Proc SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/selecting-good-matches-by-Proc-SQL/m-p/98138#M27639</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create the closiness column, and make use of GROUP BY and HAVING (max(...)) clauses.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Sep 2013 06:24:40 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2013-09-30T06:24:40Z</dc:date>
    <item>
      <title>selecting good matches by Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/selecting-good-matches-by-Proc-SQL/m-p/98137#M27638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;I have a data set of 434 observation (named as selection) and another data-set with about 17000 observations (named as nodup). The first data-set is my main analysis group (study group) and I want to select one control match from the second data-set for each of the observations in the study group. The matching variables are SIC, FYEAR, SALE. the first two should be exact matches, while SALE should be between a range, defined by lowsale and highsale variables. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;If I run this PROC SQL, I will get &lt;/SPAN&gt;multiple&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt; matches for some of the &lt;/SPAN&gt;&lt;SPAN style="line-height: 19.5px;"&gt;observation&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em;"&gt; in my study group, while for some others, there is only one match.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table controls_id as&lt;/P&gt;&lt;P&gt;select * from selection, nodup&lt;/P&gt;&lt;P&gt;where ((nodup.xSALE between selection.lowsale and selection.highsale) and&lt;/P&gt;&lt;P&gt;and selection.SIC=nodup.xsic&lt;/P&gt;&lt;P&gt;and selection.fyear=nodup.xfyear );&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I have multiple matches, I want to select the closest match for my observation. the closeness is defined as ((sale-xsale)^2). In other words, I want to select the match which has the smallest difference in the sale variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you please let me know how I can perform this step?&lt;/P&gt;&lt;P&gt;Thanks for reading this post&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 04:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/selecting-good-matches-by-Proc-SQL/m-p/98137#M27638</guid>
      <dc:creator>niam</dc:creator>
      <dc:date>2013-09-30T04:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: selecting good matches by Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/selecting-good-matches-by-Proc-SQL/m-p/98138#M27639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create the closiness column, and make use of GROUP BY and HAVING (max(...)) clauses.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 06:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/selecting-good-matches-by-Proc-SQL/m-p/98138#M27639</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-09-30T06:24:40Z</dc:date>
    </item>
  </channel>
</rss>

