<?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 cases with controls in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254680#M48603</link>
    <description>&lt;P&gt;To get a full dataset, ready for analysis, try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data stackedMatches2;
length type $8;
label group="Group" type="Type" id="Id" ctrlId="Control Id";
set bestMatches;
caseId = floor(sampleNode);
if caseId ne lag(caseId) then do;
    ctrlId = .;
    group + 1;
    type = "Case";
    Id = caseId;
    output;
    end;
ctrlId + 1;
type = "Control";
Id = controlNode;
output;
keep group type ctrlId id;
run;

proc sql;
create table allMatches as
select a.group, a.type, a.ctrlId, b.*
from stackedMatches2 as a inner join sample as b on a.id=b.id
union all corresponding
select a.group, a.type, a.ctrlId, b.*
from stackedMatches2 as a inner join controls as b on a.id=b.id
order by group, type, ctrlId;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 05 Mar 2016 04:30:14 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-03-05T04:30:14Z</dc:date>
    <item>
      <title>Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252204#M47819</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to match cases with controls on these variables: age (± 3 years), edu (± 2), race, parity (0,≥1) and date of blood sample (dobw).&amp;nbsp; I am providing sample data as my original data are still not ready.&amp;nbsp; I also could not enter variable dobw.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If possible, please give some guidance on entering in SAS correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample;&lt;BR /&gt;input id age edu race parity wt ht;&lt;BR /&gt;datalines;&lt;BR /&gt;05 32 9 1 0 90 5.2&lt;BR /&gt;12 35 12 1 2 110 5.0&lt;BR /&gt;17 40 10 2 1 130 4.9&lt;BR /&gt;22 25 14 3 0 110 5.4&lt;BR /&gt;29 27 12 2 1 95 5.0&lt;BR /&gt;40 28 10 3 2 130 6&lt;BR /&gt;;&lt;BR /&gt;data controls;&lt;BR /&gt;input id age edu race parity wt ht;&lt;BR /&gt;datalines;&lt;BR /&gt;10 33 11 2 1 98 5.7&lt;BR /&gt;11 35 10 2 2 120 5.9&lt;BR /&gt;19 42 11 1 3 139 5.9&lt;BR /&gt;26 26 14 0 1 99 5.0&lt;BR /&gt;31 27 10 2 1 95 5.5&lt;BR /&gt;32 29 12 2 2 125 6.2&lt;BR /&gt;37 31 10 2 1 190 7.2&lt;BR /&gt;43 35 12 1 1 110 5.0&lt;BR /&gt;46 45 10 1 1 130 4.9&lt;BR /&gt;51 28 12 3 0 110 5.4&lt;BR /&gt;55 22 10 1 1 95 5.0&lt;BR /&gt;58 28 10 3 2 130 6&lt;BR /&gt;70 32 9 1 0 90 5.2&lt;BR /&gt;79 37 11 1 2 110 5.0&lt;BR /&gt;85 48 14 2 1 130 4.9&lt;BR /&gt;88 29 14 3 0 110 5.4&lt;BR /&gt;90 25 14 2 1 95 5.0&lt;BR /&gt;93 27 11 3 2 130 6&lt;BR /&gt;99 35 10 1 0 90 5.2&lt;BR /&gt;101 33 11 1 2 110 5.0&lt;BR /&gt;114 38 16 2 1 130 4.9&lt;BR /&gt;125 25 13 3 0 110 5.4&lt;BR /&gt;129 25 10 2 1 95 5.0&lt;BR /&gt;130 24 11 3 2 130 6&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 20:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252204#M47819</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-02-24T20:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252209#M47820</link>
      <description>Attaching a sample of desired output based on your inputs helps describing your requirement. &lt;BR /&gt;SQL join with between-and criteria is one way to handle matching on ranges.</description>
      <pubDate>Wed, 24 Feb 2016 20:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252209#M47820</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-24T20:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252239#M47834</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I could not find the attachment.&amp;nbsp; May be I am missing; I am a new member and don't know much about the communication.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 21:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252239#M47834</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-02-24T21:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252252#M47843</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I accidently clicked the 'accept the solution' tab; I have not been able to access the solution on this page. I will appreciate if I could access the solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Abdul&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 23:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252252#M47843</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-02-24T23:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252282#M47852</link>
      <description>&lt;P&gt;If you have a licence to SAS/OR, you can easily find an optimal assignment with &lt;STRONG&gt;proc optnet&lt;/STRONG&gt;, even with many controls per case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input id age edu race parity wt ht;
datalines;
05 32 9 1 0 90 5.2
12 35 12 1 2 110 5.0
17 40 10 2 1 130 4.9
22 25 14 3 0 110 5.4
29 27 12 2 1 95 5.0
40 28 10 3 2 130 6
;
data controls;
input id age edu race parity wt ht;
datalines;
10 33 11 2 1 98 5.7
11 35 10 2 2 120 5.9
19 42 11 1 3 139 5.9
26 26 14 0 1 99 5.0
31 27 10 2 1 95 5.5
32 29 12 2 2 125 6.2
37 31 10 2 1 190 7.2
43 35 12 1 1 110 5.0
46 45 10 1 1 130 4.9
51 28 12 3 0 110 5.4
55 22 10 1 1 95 5.0
58 28 10 3 2 130 6
70 32 9 1 0 90 5.2
79 37 11 1 2 110 5.0
85 48 14 2 1 130 4.9
88 29 14 3 0 110 5.4
90 25 14 2 1 95 5.0
93 27 11 3 2 130 6
99 35 10 1 0 90 5.2
101 33 11 1 2 110 5.0
114 38 16 2 1 130 4.9
125 25 13 3 0 110 5.4
129 25 10 2 1 95 5.0
130 24 11 3 2 130 6
;

/* Find all possible matches */
proc sql;
create table matches as
select 
    s.id as sampleId, 
    c.id as controlId,
    euclid((c.age-s.age)/7, (c.edu-s.edu)/5) as distance format=5.2
from 
    sample as s left join 
    controls as c
    on  c.age between s.age-3 and s.age+3 and
        c.edu between s.edu-2 and s.edu+2 and
        c.race = s.race and
        (c.parity=0) = (s.parity=0)
order by sampleId, distance;
select * from matches;
quit;

/* How many controls per sample ? */
%let controlsPerSample=2;

/* Prepare data for linear assingment algorithm */
data links;
set matches;
where not missing(controlId);
controlNode = controlId;
do i = 1 to min(99, &amp;amp;controlsPerSample);
    sampleNode = sampleId + i/100;
    output;
    end;
format sampleNode 10.2;
keep sampleNode controlNode distance;
run;

/* Perform best linear assignment algorithm */
proc optnet data_links=links graph_direction=directed;
data_links_var from=sampleNode to=controlNode weight=distance;
linear_assignment out=bestMatches;
run;

proc sql;
select 
    floor(sampleNode) as sampleId,
    controlNode as controlId
from bestMatches;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Feb 2016 03:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252282#M47852</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-02-25T03:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252301#M47857</link>
      <description>&lt;P&gt;Dear PG,&lt;/P&gt;&lt;P&gt;Excellent!&amp;nbsp; I am very much grateful to you for your time and effort!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the output data.&amp;nbsp; There was only one problem, it did not match with no 17 sample; may be there was no match.&lt;/P&gt;&lt;P&gt;Can you write me the code for the date of blood sample withdrawn (dobw)?&amp;nbsp; I have to receive this information from our data management unit, I ll be bit flexible and take it in upto two weeks±.&amp;nbsp; Also, is there any simple way of entering date in sas.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;TABLE border="0" cellpadding="1" cellspacing="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;The SAS System&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;sampleId controlsId &lt;TABLE cellpadding="5" cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;99&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;125&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;51&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;58&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;93&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 25 Feb 2016 06:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252301#M47857</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-02-25T06:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252302#M47858</link>
      <description>What I meant was that you should attach (or paste) the desired output.&lt;BR /&gt;What about the SQL idea?</description>
      <pubDate>Thu, 25 Feb 2016 06:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252302#M47858</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-25T06:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252386#M47875</link>
      <description>&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I stack each sample with its two matched controls?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 14:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252386#M47875</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-02-25T14:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252449#M47911</link>
      <description>&lt;P&gt;Glad you could run my code. I hope you can adapt it to your precise requirements. Revise the &lt;EM&gt;distance&lt;/EM&gt; calculation to make sure it weights the matching criteria the way you want. I guess you will want to include the dobw in the distance calculation when it becomes available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are right, there was no match for case 17.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS can handle a great variety of date formats. Something like 2016-02-25 will do just fine.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 17:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/252449#M47911</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-02-25T17:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254544#M48563</link>
      <description>&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't run SAS codes for analysis.&amp;nbsp; The final data in the form of matched set contains only the IDs of both cases and controls. Can yo uguide me how to bring all the variables alongwith IDs in the final matchd file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 17:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254544#M48563</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-04T17:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254579#M48575</link>
      <description>&lt;P&gt;Not sure what you mean by &lt;EM&gt;stacking&lt;/EM&gt;, but here are two possibilities&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Stacked matches are either ... */
proc sql;
create table finalMatches as
select 
    floor(sampleNode) as caseId "Case Id",
    controlNode as controlId
from bestMatches;
quit;

proc transpose data=finalMatches out=stackedMatches1(drop=_name_) prefix=control; 
by caseId;
var controlId;
run;

/* ... Or */
data stackedMatches2;
length type $8;
label group="Group" type="Type" id="Id";
set bestMatches;
caseId = floor(sampleNode);
if caseId ne lag(caseId) then do;
    ctrl = 0;
    group + 1;
    type = "Case";
    Id = caseId;
    output;
    end;
ctrl + 1;
type = cats("Control", ctrl);
Id = controlNode;
output;
keep group type id;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Mar 2016 19:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254579#M48575</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-04T19:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254632#M48595</link>
      <description>&lt;P&gt;Hi PG,&lt;/P&gt;&lt;P&gt;Thanks again for guiding me! The second code, with stack…, worked; I wanted the data in this shape.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As this datafile, in this case stackmatches 2, contains only IDs and no other information. For analysis when I run SAS code, to which datafile should I apply this code, stachmatches 2 does not have information on other variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 22:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254632#M48595</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-04T22:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254680#M48603</link>
      <description>&lt;P&gt;To get a full dataset, ready for analysis, try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data stackedMatches2;
length type $8;
label group="Group" type="Type" id="Id" ctrlId="Control Id";
set bestMatches;
caseId = floor(sampleNode);
if caseId ne lag(caseId) then do;
    ctrlId = .;
    group + 1;
    type = "Case";
    Id = caseId;
    output;
    end;
ctrlId + 1;
type = "Control";
Id = controlNode;
output;
keep group type ctrlId id;
run;

proc sql;
create table allMatches as
select a.group, a.type, a.ctrlId, b.*
from stackedMatches2 as a inner join sample as b on a.id=b.id
union all corresponding
select a.group, a.type, a.ctrlId, b.*
from stackedMatches2 as a inner join controls as b on a.id=b.id
order by group, type, ctrlId;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Mar 2016 04:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254680#M48603</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-05T04:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254791#M48624</link>
      <description>&lt;P&gt;Dear PGstats,&lt;/P&gt;&lt;P&gt;Once again thanks a lot!&lt;/P&gt;&lt;P&gt;I was able to get data with all variables and could perform analysis.&lt;/P&gt;&lt;P&gt;As I shared with you this is not my real dataset; I will be getting my dataset soon and write codes for my real dataset and see if there is any problem will let you know.&amp;nbsp; I hope you won't mind.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2016 02:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254791#M48624</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-06T02:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254793#M48626</link>
      <description>&lt;P&gt;Best of luck!&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2016 03:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/254793#M48626</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-06T03:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/255534#M48803</link>
      <description>&lt;P&gt;Hi PGstats,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing this after exploring the web/SAS pages to find out answer but could not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How the following figures, such as 7 and 5 as demonitors and format are determined? As I plan to add my another matching variable, the date of blood withdrawal, with a matching range of 2 weeks, I need this information for completing the code in addition to my knowledge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;euclid((c.age-s.age)/7, (c.edu-s.edu)/5) as distance format=5.2.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 14:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/255534#M48803</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-03-09T14:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/255554#M48811</link>
      <description>&lt;P&gt;The 5 and 7 denominators were chosen arbitrarily to correspond to the allowed mismatch range for both variables. You could use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;euclid((c.age-s.age)/3, (c.edu-s.edu)/2) as distance&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;instead to scale both mismatches from -1 to +1 or any other scaling that reflects the relative importance of matching age and edu.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Following the same logic, you could add dobw as a matching variable in the distance calculation with&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;euclid((c.age-s.age)/3, (c.edu-s.edu)/2, (c.dobw-s.dobw)/14) as distance&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;with the extra join condition&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;c.dobw between s.dobw-14 and s.dobw+14 and&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The format given to distances is only used for display purposes, it has no impact on calculations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 15:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/255554#M48811</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-09T15:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/269636#M53449</link>
      <description>&lt;P&gt;Dear PGStats:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Referring to Proc Optnet, I am trying to use it for my original dataset with libref 9not work library) it does not work. Log says 'Work.Links.Data' not found. Please guide me.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 04:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/269636#M53449</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-05-11T04:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/269760#M53486</link>
      <description>&lt;P&gt;The way to refer to a dataset is MYLIBREF.MYDATASET . If you do not specify MYLIBREF then the temporary library WORK is used. So if your LINK dataset is not in the WORK library you must prefix its name with your libref.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 15:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/269760#M53486</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-05-11T15:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Matching cases with controls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/269786#M53491</link>
      <description>&lt;P&gt;As I mentioend earlier, I've Links dataset in my permanent library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While using Proc optnet data_links=links, the program takes it, probably, as coming from Work library which is actually not.&lt;/P&gt;&lt;P&gt;How can I use my libref which is "pe." here? Where should I write it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 16:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-cases-with-controls/m-p/269786#M53491</guid>
      <dc:creator>wajmsu</dc:creator>
      <dc:date>2016-05-11T16:27:36Z</dc:date>
    </item>
  </channel>
</rss>

