<?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: searching for age within range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793421#M254313</link>
    <description>&lt;P&gt;oh yea, 30... edited&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jan 2022 04:59:57 GMT</pubDate>
    <dc:creator>axescot78</dc:creator>
    <dc:date>2022-01-31T04:59:57Z</dc:date>
    <item>
      <title>searching for age within range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793418#M254311</link>
      <description>&lt;P&gt;I have 2 datasets that look like the this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data match_data;
input uniq_ID_A $ Sex $ Race $ Dx_Age 3. uniq_ID_B $ Sex $ Race $ Age_Begin 3. Age_End 3.;
datalines;
5018 F B 35 1013 F B 36 39
3127 M H 25 2996 M H 26 37
5571 M W 32 1290 M W 33 42
2058 F W 35 4130 F W 38 45
1785 F B 37 3053 F B 38 41
1278 M W 49 1686 M W 49 53
2446 M W 33 3716 M W 35 44
3067 M H 39 5010 M H 40 52
3146 M B 32 5299 M B 32 45
3429 M B 30 5243 M B 30 35
5771 M A 30 4027 M A 31 42
;


data pt_data;
input uniq_ID_B $ DOB:MMDDYY10. Visit_Date:MMDDYY10. Visit_Reason_Code $ Other_Demographic_Data $ ;
format DOB MMDDYY10. Visit_Date MMDDYY10.;
datalines;
2996 9/25/1990 9/24/2016 6 xzxz
2996 9/25/1990 11/15/2016 6 xzxz
2996 9/25/1990 12/5/2016 4 xzxz
5299 12/1/1984 12/1/2016 2 xzxz
5299 12/1/1984 12/27/2016 5 xzxz
5299 12/1/1984 2/21/2017 5 xzxz
5299 12/1/1984 3/14/2017 1 xzxz
5299 12/1/1984 4/26/2017 6 xzxz
5299 12/1/1984 5/21/2017 5 xzxz
4027 6/3/1990 6/2/2021 1 xzxz
4027 6/3/1990 7/5/2021 4 xzxz
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first has a study population matched with a control population. Due to size constraints, I couldn't pull all the data that I wanted from the control population. Now I would like to go back to the second data set and pull the remaining data. However, I am only interested in the entry whose age is closest to the match from the first data set. For example, for 2996 I am interested in the entry whose age is closest to 25 (the age of his match). For 5299, I am interested in the entry when he was 32 (the age of his match). Same for 4027, 30, the age of his match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any advice how to code this?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 05:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793418#M254311</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2022-01-31T05:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: searching for age within range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793420#M254312</link>
      <description>"Same for 4027, 31, the age of his match."&lt;BR /&gt;&lt;BR /&gt;Is it not 30?</description>
      <pubDate>Mon, 31 Jan 2022 04:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793420#M254312</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2022-01-31T04:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: searching for age within range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793421#M254313</link>
      <description>&lt;P&gt;oh yea, 30... edited&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 04:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793421#M254313</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2022-01-31T04:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: searching for age within range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793425#M254317</link>
      <description>&lt;P&gt;Please show exactly which obs to pull from the second dataset and explain what what should happen, if two obs in the second dataset have the same age.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 06:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793425#M254317</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-01-31T06:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: searching for age within range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793427#M254318</link>
      <description>Good catch! So this is fake data that I created for this post. The actual data has ages to 2 decimal places so there won't be any observations with the same age.</description>
      <pubDate>Mon, 31 Jan 2022 07:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793427#M254318</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2022-01-31T07:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: searching for age within range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793432#M254321</link>
      <description>I ended up calculating the age difference, sorting by ID and age difference smallest to largest, and then selecting the first ID entry. Worked well.</description>
      <pubDate>Mon, 31 Jan 2022 07:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/searching-for-age-within-range/m-p/793432#M254321</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2022-01-31T07:47:49Z</dc:date>
    </item>
  </channel>
</rss>

