<?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: latest date (dtc) on or prior to the rand_dtc in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164470#M42681</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If dtc and rand_dtc in your data set have data type DATE, this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="mso-bidi-font-size: 9.0pt; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc &lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&lt;STRONG style="mso-bidi-font-size: 9.0pt; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;create &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;table &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;need &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;* &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt; have &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;rand_dtc &amp;gt;= dtc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt; Pt_ID&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; having &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;dtc = max(dtc);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="mso-bidi-font-size: 9.0pt; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Feb 2014 17:46:46 GMT</pubDate>
    <dc:creator>Marina</dc:creator>
    <dc:date>2014-02-06T17:46:46Z</dc:date>
    <item>
      <title>latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164461#M42672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get records with&amp;nbsp; the latest assessment date on or prior to the rand_dtc.&amp;nbsp; It would be great guru's can provide the logic or code.&amp;nbsp; Thanks for your time and help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EX:&amp;nbsp; The data I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pt_ID&amp;nbsp;&amp;nbsp; wt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ht&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rand_dtc&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/20/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/18/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pt_ID&amp;nbsp;&amp;nbsp; wt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ht&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rand_dtc&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/18/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 18:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164461#M42672</guid>
      <dc:creator>Almighty</dc:creator>
      <dc:date>2014-02-05T18:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164462#M42673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input (Pt_ID wt ht) (:$) (dtc rand_dtc) (:mmddyy10.);&lt;/P&gt;&lt;P&gt;format dtc rand_dtc mmddyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 70 180 4/10/2010 5/20/2010&lt;/P&gt;&lt;P&gt;101 68 180 4/15/2010 5/20/2010&lt;/P&gt;&lt;P&gt;101 65 180 4/20/2010 5/20/2010&lt;/P&gt;&lt;P&gt;101 71 180 5/18/2010 5/20/2010&lt;/P&gt;&lt;P&gt;102 65 160 6/10/2010 8/15/2010&lt;/P&gt;&lt;P&gt;102 66 160 8/15/2010 8/15/2010&lt;/P&gt;&lt;P&gt;103 72 175 3/10/2010 6/10/2010&lt;/P&gt;&lt;P&gt;103 71 175 4/10/2010 6/10/2010&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*if dtc always less equal to rand_dtc*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want_1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * from have&lt;/P&gt;&lt;P&gt;group by Pt_ID&lt;/P&gt;&lt;P&gt;having dtc = max(dtc);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*else slower but more robust solution*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want_1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * from have (where=(rand_dtc-dtc &amp;gt;= 0))&lt;/P&gt;&lt;P&gt;group by Pt_ID&lt;/P&gt;&lt;P&gt;having dtc = max(dtc);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 19:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164462#M42673</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-02-05T19:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164463#M42674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hai.Kuo:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As usual you are the best.&amp;nbsp; I am expecting for several patients DTC is more than RAND_DTC: example below pt_ID: 104.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;EX:&amp;nbsp; The data I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Pt_ID&amp;nbsp;&amp;nbsp; wt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ht&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rand_dtc&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/20/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/18/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/26/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Data need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Pt_ID&amp;nbsp;&amp;nbsp; wt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ht&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rand_dtc&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/18/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 19:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164463#M42674</guid>
      <dc:creator>Almighty</dc:creator>
      <dc:date>2014-02-05T19:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164464#M42675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then the second solution should work for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck,&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 19:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164464#M42675</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-02-05T19:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164465#M42676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #444444; font-family: Calibri, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;This worked, but:&lt;/P&gt;&lt;P style="color: #444444; font-family: Calibri, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="color: #444444; font-family: Calibri, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;if the DTC values are null then those records are dropping.&amp;nbsp; But I wanted to include those records with DTC values are null.&lt;/P&gt;&lt;P style="color: #444444; font-family: Calibri, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="color: #444444; font-family: Calibri, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV&gt;proc sql;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table asa1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN class="ecxApple-tab-span"&gt; &lt;/SPAN&gt;select * from asa (where=(randdt-cmstdt &amp;gt;= 0))&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ecxApple-tab-span"&gt; &lt;/SPAN&gt;group by subjid&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ecxApple-tab-span"&gt; &lt;/SPAN&gt;having cmstdt = max(cmstdt);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;I used this code, where some of the records have CMSTDT values are null.&amp;nbsp; I don't want those records to be dropped.&amp;nbsp; Could you please help me.&lt;/P&gt;&lt;P&gt;Appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;EX:&amp;nbsp; The data I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Pt_ID&amp;nbsp;&amp;nbsp; wt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ht&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rand_dtc&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/26/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Data need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Pt_ID&amp;nbsp;&amp;nbsp; wt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ht&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rand_dtc&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/15/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/10/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/2010&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/20/2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/25/2010&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 15:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164465#M42676</guid>
      <dc:creator>Almighty</dc:creator>
      <dc:date>2014-02-06T15:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164466#M42677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For that, we have an easy fix:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want_1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * from have (where=(sum(rand_dtc,-dtc) &amp;gt;= 0))&lt;/P&gt;&lt;P&gt;group by Pt_ID&lt;/P&gt;&lt;P&gt;having dtc = max(dtc);&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>Thu, 06 Feb 2014 16:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164466#M42677</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-02-06T16:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164467#M42678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Almighty,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo sol is better than mine , but another approach&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; want_1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; *,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; dtc &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; _dtc &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; have &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; (rand_dtc-dtc) ge &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; or calculated _dtc eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; Pt_ID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;having dtc = max(dtc);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 16:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164467#M42678</guid>
      <dc:creator>sam369</dc:creator>
      <dc:date>2014-02-06T16:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164468#M42679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haikuo,&lt;/P&gt;&lt;P&gt;it didn't work in addtion i was getting duplicate records also...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 16:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164468#M42679</guid>
      <dc:creator>Almighty</dc:creator>
      <dc:date>2014-02-06T16:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164469#M42680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please post some sample data. If you have duplicated dtc within the sample ft_id, yes, you will get duplicates in term of dtc. In that case, you want to add another step such as proc sort, or data step to remove them. The following only takes care of those where the whole record is identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want_1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select &lt;STRONG&gt;distinct&lt;/STRONG&gt; * from have (where=&lt;STRONG&gt;(sum(rand_dtc,-dtc) &amp;gt;= 0&lt;/STRONG&gt;))&lt;/P&gt;&lt;P&gt;group by Pt_ID&lt;/P&gt;&lt;P&gt;having dtc = max(dtc);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 17:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164469#M42680</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-02-06T17:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164470#M42681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If dtc and rand_dtc in your data set have data type DATE, this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="mso-bidi-font-size: 9.0pt; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc &lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&lt;STRONG style="mso-bidi-font-size: 9.0pt; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;create &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;table &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;need &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;* &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt; have &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;rand_dtc &amp;gt;= dtc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt; Pt_ID&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; having &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;dtc = max(dtc);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="mso-bidi-font-size: 9.0pt; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-bidi-font-size: 9.0pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 17:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164470#M42681</guid>
      <dc:creator>Marina</dc:creator>
      <dc:date>2014-02-06T17:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: latest date (dtc) on or prior to the rand_dtc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164471#M42682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haikuo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&amp;nbsp; I just posted another questions, would you kindly find sometime to help.&amp;nbsp; I tried to do by myself, but somehow I am missing the logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="52983" __jive_macro_name="thread" class="jive_macro jive_macro_thread" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 15:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/latest-date-dtc-on-or-prior-to-the-rand-dtc/m-p/164471#M42682</guid>
      <dc:creator>Almighty</dc:creator>
      <dc:date>2014-02-13T15:47:25Z</dc:date>
    </item>
  </channel>
</rss>

