<?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 Working with Ages in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124418#M260022</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my current project I need to create one profile for each patient based on many different medical visits. I am wondering if there is a way to tell SAS to only keep the record from the most recent visit (when the patient was the oldest). Each patient reports their age for each visit and there is a unique identifier for each person. I have figured out how to drop the duplicates when the age was the same, now I need to figure out how to get only the most recent records from each patient (the record when they were the oldest). Any suggestions on how I could do this in SAS?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Apr 2013 18:59:19 GMT</pubDate>
    <dc:creator>branbran</dc:creator>
    <dc:date>2013-04-29T18:59:19Z</dc:date>
    <item>
      <title>Working with Ages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124418#M260022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my current project I need to create one profile for each patient based on many different medical visits. I am wondering if there is a way to tell SAS to only keep the record from the most recent visit (when the patient was the oldest). Each patient reports their age for each visit and there is a unique identifier for each person. I have figured out how to drop the duplicates when the age was the same, now I need to figure out how to get only the most recent records from each patient (the record when they were the oldest). Any suggestions on how I could do this in SAS?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2013 18:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124418#M260022</guid>
      <dc:creator>branbran</dc:creator>
      <dc:date>2013-04-29T18:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Ages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124419#M260023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you don't have a visit date to associate with each visit? Using patient reported age seems shaky. But if that is only what you can leverage, Proc SQL seems to have a straightforward approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * from have&lt;/P&gt;&lt;P&gt;&amp;nbsp; group by patid&lt;/P&gt;&lt;P&gt;having age=max(age)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;patid is the patient identifier, change it to fit your variable name.&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, 29 Apr 2013 19:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124419#M260023</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-04-29T19:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Ages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124420#M260024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'd better to post some dummy data to explain your question more clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;by pid descending age descending visit;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=have out=want nodupkey;&lt;/P&gt;&lt;P&gt;by pid ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 02:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Ages/m-p/124420#M260024</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-04-30T02:32:59Z</dc:date>
    </item>
  </channel>
</rss>

