<?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 How to create a new variable for matched controls in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167864#M43469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a cohort of patients who saw their doctors for back pain. Some patients got x-rays (cases) and some did not (controls). I used the one to many match macro (&lt;A href="http://www2.sas.com/proceedings/sugi29/165-29.pdf" title="http://www2.sas.com/proceedings/sugi29/165-29.pdf"&gt;http://www2.sas.com/proceedings/sugi29/165-29.pdf&lt;/A&gt;), to create a dataset of matched cases and controls and includes the match_1 variable that's the same for each case and each control so I can identify pairs. I'm wondering if the patients who got x-rays had more doctor's visits during the follow-up period (by definition, all cases and controls were followed for 1 year after their first visit) compared to controls. I want to begin counting doctor's visits on the day of the x-ray for cases and on the analogous number of days since the index visit for controls so that their follow-up times are the same. It's pretty easy for cases to identify the "start day" as the day of their x-ray, but I'm not sure how to tell SAS to create a variable for the controls that is equal to the "start day" for each pair's case. I'm not too familiar with proc SQL but it seems like that might be the way to go?&lt;/P&gt;&lt;P&gt;Thanks so much in advance for any guidance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Apr 2014 19:10:07 GMT</pubDate>
    <dc:creator>Lefty</dc:creator>
    <dc:date>2014-04-03T19:10:07Z</dc:date>
    <item>
      <title>How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167864#M43469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a cohort of patients who saw their doctors for back pain. Some patients got x-rays (cases) and some did not (controls). I used the one to many match macro (&lt;A href="http://www2.sas.com/proceedings/sugi29/165-29.pdf" title="http://www2.sas.com/proceedings/sugi29/165-29.pdf"&gt;http://www2.sas.com/proceedings/sugi29/165-29.pdf&lt;/A&gt;), to create a dataset of matched cases and controls and includes the match_1 variable that's the same for each case and each control so I can identify pairs. I'm wondering if the patients who got x-rays had more doctor's visits during the follow-up period (by definition, all cases and controls were followed for 1 year after their first visit) compared to controls. I want to begin counting doctor's visits on the day of the x-ray for cases and on the analogous number of days since the index visit for controls so that their follow-up times are the same. It's pretty easy for cases to identify the "start day" as the day of their x-ray, but I'm not sure how to tell SAS to create a variable for the controls that is equal to the "start day" for each pair's case. I'm not too familiar with proc SQL but it seems like that might be the way to go?&lt;/P&gt;&lt;P&gt;Thanks so much in advance for any guidance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 19:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167864#M43469</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2014-04-03T19:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167865#M43470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will help if you can provide some lines of dummy data to indicate what you have and what you want the output to look like. Make sure you have at least one of the not-obvious combinations of data to work with.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 22:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167865#M43470</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-04-03T22:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167866#M43471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestion! Here's a table of what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: none;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Match_1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;X-ray&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Day of xray&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;--&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;15&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;--&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And what I would like is for SAS to create a new variable, Generic_day, that looks like this:&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: none;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Match_1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;X-ray&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Day of xray&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="155"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;Generic_day&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="155"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;--&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="155"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;15&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="155"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;15&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="161"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="160"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="162"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;--&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="155"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;15&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;So that each matched control has an "anchor" date that is the same as the day the cases received x-rays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps and thanks again in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 23:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167866#M43471</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2014-04-03T23:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167867#M43472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use retain statement to get the result for the above problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data bug;&lt;/P&gt;&lt;P&gt;retain generic_day;&lt;/P&gt;&lt;P&gt;set xray;&lt;/P&gt;&lt;P&gt;if x-ray=1 then generic_day=day of xray;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this works. if not please elobrate the problem you are facing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Apr 2014 06:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167867#M43472</guid>
      <dc:creator>Chrishi</dc:creator>
      <dc:date>2014-04-04T06:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167868#M43473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response. No, that doesn't work, the result when I do that is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: none; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="161"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Match_1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="160"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;X-ray&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="162"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Day of xray&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="155"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Generic_day&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="161"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="160"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="162"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="155"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;10&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="161"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="160"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="162"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;--&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="155"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;--&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="161"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="160"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="162"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;15&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="155"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;15&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding: 0 5.4pt; border: 1pt solid windowtext; font-style: inherit; font-family: inherit;" valign="top" width="161"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;2&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="160"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="162"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;--&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 0 5.4pt; border-right-width: 1pt; border-bottom-width: 1pt; border-style: none solid solid none; border-right-color: windowtext; border-bottom-color: windowtext; font-style: inherit; font-family: inherit;" valign="top" width="155"&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;--&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;And generic_day is still missing for people who did not have x-rays. I must be misunderstanding the retain statement?&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thanks again for any advice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 18:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167868#M43473</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2014-04-07T18:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167869#M43474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, I tried a few other things and finally got it to work by using this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data bug;&lt;/P&gt;&lt;P&gt;set xray;&lt;/P&gt;&lt;P&gt;by match_1;&lt;/P&gt;&lt;P&gt;retain Day_of_xray Generic_day;&lt;/P&gt;&lt;P&gt;if x-ray=1 then Generic_day=Day_of_xray; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the key thing is retaining the generic_day variable as well as the day_of_xray variable.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 19:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167869#M43474</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2014-04-07T19:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167870#M43475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your data is laid out exactly as you have shown here (eg. sorted by ascending match_1 and descending x-ray), @chrishi 's code will work. If not, either you need to sort the data before implementing @chrishi's code or opt for Proc SQL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE WANT AS&lt;/P&gt;&lt;P&gt;&amp;nbsp; SELECT *, MAX(DAYSOFXRAY) AS GENERIC_DAY FROM HAVE GROUP BY MATCH_1;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 19:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167870#M43475</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-04-07T19:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable for matched controls</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167871#M43476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the point of retaining a data set variable such as&amp;nbsp; "Day_of_xray" if it is overridden each time new data is read in (they are automatically retained anyway)?&amp;nbsp; And why "by match_1" if you are NOT using any of "first., last." variables (at least you haven't shown it in your code). Are we seeing the whole pictures here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 19:22:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-new-variable-for-matched-controls/m-p/167871#M43476</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-04-07T19:22:44Z</dc:date>
    </item>
  </channel>
</rss>

