<?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: Using SAS® to Perform Individual Matching in Design of Case-Control Studies - setnumber? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Using-SAS-to-Perform-Individual-Matching-in-Design-of-Case/m-p/408122#M21249</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see attached PDF&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2017 17:54:50 GMT</pubDate>
    <dc:creator>kfwright23</dc:creator>
    <dc:date>2017-10-27T17:54:50Z</dc:date>
    <item>
      <title>Using SAS® to Perform Individual Matching in Design of Case-Control Studies - setnumber?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-SAS-to-Perform-Individual-Matching-in-Design-of-Case/m-p/405028#M21116</link>
      <description>&lt;P&gt;I attempted to replicate the code listed in the appendix of this paper:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings10/061-2010.pdf&amp;nbsp;" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings10/061-2010.pdf&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not think that this step is working for me.&amp;nbsp;&amp;nbsp;I would greatly appreciate&amp;nbsp;any suggestions to correct my code.&lt;/P&gt;&lt;P&gt;************Select the first case- the step is repeated for all cases**************;&lt;/P&gt;&lt;P&gt;&amp;nbsp;data active;&lt;/P&gt;&lt;P&gt;setnumber = 1;&lt;/P&gt;&lt;P&gt;set cases point=setnumber ;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code that I used with my variables, not using the macro:&lt;/P&gt;&lt;P&gt;/****************** Code Generated From Call of Macro *************&lt;BR /&gt;Assume&amp;nbsp;a working data set named cases and controls&lt;BR /&gt;************************************************************************/&lt;BR /&gt;* Sort control dataset by a random number;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table random_controls as&lt;BR /&gt;SELECT *,&lt;BR /&gt;ranuni(12345) as random from controls order by random;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* Rename control variable names - put c_ at beginning (code not shown);&lt;BR /&gt;* Select the first case- the step is repeated for all cases;&lt;/P&gt;&lt;P&gt;data active;&lt;BR /&gt;setnumber = 1;&lt;BR /&gt;set TalTen point=setnumber;&lt;BR /&gt;output;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;********************************************************************&lt;BR /&gt;Main section of the program. Create dataset for matches, non-matches&lt;BR /&gt;********************************************************************;&lt;BR /&gt;data match (keep = bannerid pell act_maxcomp hs_gpa3 setnumber ccstat)&lt;BR /&gt;nomatch (keep = bannerid pell act_maxcomp hs_gpa3)&lt;BR /&gt;used (keep= c_bannerid);&lt;BR /&gt;set active ; * This has the current case;&lt;/P&gt;&lt;P&gt;* Read through control dataset with random access and pointer option;&lt;BR /&gt;do i = 1 to totobs;&lt;BR /&gt;set random_controls point=i nobs=totobs;&lt;/P&gt;&lt;P&gt;* Check if case and control data match;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if abs (pell - c_pell) = 0 and&lt;BR /&gt;abs (act_maxcomp - c_act_maxcomp) &amp;lt;= 1 and&lt;BR /&gt;abs (hs_gpa3 - c_hs_gpa3) &amp;lt;= .2 then do;&lt;BR /&gt;* We have a match!;&lt;BR /&gt;ccstat= 1;&lt;BR /&gt;output match; * This is the case data, aadding variable ccstat = 1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* Store control values in variables with same name as case;&lt;BR /&gt;* Then output again to same dataset;&lt;BR /&gt;pell = c_pell;&lt;BR /&gt;act_maxcomp = c_act_maxcomp;&lt;BR /&gt;hs_gpa3 = c_hs_gpa3;&lt;BR /&gt;bannerid = c_bannerid;&lt;BR /&gt;ccstat= 2;&lt;BR /&gt;output match;&lt;BR /&gt;* Output control data values to USED dataset;&lt;BR /&gt;output used;&lt;BR /&gt;stop; * Need to end DATA step since we have a match;&lt;BR /&gt;end;&lt;BR /&gt;end; * ends I loop;&lt;BR /&gt;output nomatch; * If I loop is exhausted then no match;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*SAS Global Forum 2010 Coders' Corner&lt;BR /&gt;9*/&lt;/P&gt;&lt;P&gt;proc append data=match&lt;BR /&gt;base=matchall;&lt;/P&gt;&lt;P&gt;proc append data=nomatch&lt;BR /&gt;base=nomatchall;&lt;/P&gt;&lt;P&gt;* Need to re-sort control dataset by subject id;&lt;BR /&gt;proc sort data=random_controls;&lt;BR /&gt;by c_bannerid;&lt;/P&gt;&lt;P&gt;* Remove used control from control dataset;&lt;BR /&gt;data random_controls;&lt;BR /&gt;merge random_controls&lt;BR /&gt;used (in=used);&lt;BR /&gt;by c_bannerid;&lt;BR /&gt;if used ne 1; *aka ^= ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;* Need to resort control dataset by random number for next iteration;;&lt;BR /&gt;proc sort data=random_controls;&lt;BR /&gt;by random;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 21:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-SAS-to-Perform-Individual-Matching-in-Design-of-Case/m-p/405028#M21116</guid>
      <dc:creator>kfwright23</dc:creator>
      <dc:date>2017-10-17T21:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using SAS® to Perform Individual Matching in Design of Case-Control Studies - setnumber?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-SAS-to-Perform-Individual-Matching-in-Design-of-Case/m-p/408122#M21249</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see attached PDF&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 17:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-SAS-to-Perform-Individual-Matching-in-Design-of-Case/m-p/408122#M21249</guid>
      <dc:creator>kfwright23</dc:creator>
      <dc:date>2017-10-27T17:54:50Z</dc:date>
    </item>
  </channel>
</rss>

