<?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: matching subjects to unique controls in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/matching-subjects-to-unique-controls/m-p/407681#M67083</link>
    <description>&lt;P&gt;Try this Google search&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;matching macro sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many others have addressed this problem over the years.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2017 15:25:20 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2017-10-26T15:25:20Z</dc:date>
    <item>
      <title>matching subjects to unique controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/matching-subjects-to-unique-controls/m-p/407622#M67073</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets of individuals, one of 1155 cases and one of 22000 potential controls. I would like to match the cases to the controls on the variable "age" (within a 1-2 year span), but I want each control to only occur once. Having matched all possible combinations, some have as few as 13 matches and some have as many as 2000. If possible, I would for each case to be matched to the same number of unique controls. The selection of controls, where there are many options, should be randomized.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; create table match as select
	a.case_id,a.case_age, b.match_id, b.match_age, ranuni(383467663) as rand
	from 	cases as a,
			controls as b
	where
	(b.match_age-1)&amp;lt;a.case_age&amp;lt;(b.match_age+1)
	order by a.case_id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used randomly generated numbers to sort by and delete duplicates among the controls. But I then end up with as few as one control for some cases (and still almost 2000 for others), and seem to lose some cases as well, which I definitely don't want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 12:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/matching-subjects-to-unique-controls/m-p/407622#M67073</guid>
      <dc:creator>Brander</dc:creator>
      <dc:date>2017-10-26T12:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: matching subjects to unique controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/matching-subjects-to-unique-controls/m-p/407681#M67083</link>
      <description>&lt;P&gt;Try this Google search&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;matching macro sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many others have addressed this problem over the years.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 15:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/matching-subjects-to-unique-controls/m-p/407681#M67083</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2017-10-26T15:25:20Z</dc:date>
    </item>
  </channel>
</rss>

