<?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: subtracting 2 dates in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727971#M28247</link>
    <description>Thanks - what does the C do in the code?&lt;BR /&gt;</description>
    <pubDate>Sun, 21 Mar 2021 02:22:31 GMT</pubDate>
    <dc:creator>lmyers2</dc:creator>
    <dc:date>2021-03-21T02:22:31Z</dc:date>
    <item>
      <title>subtracting 2 dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727965#M28245</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to find the number of years between 2 dates. The variables have the following attributes. I'm not sure why the code I have below isn't working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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; Length&amp;nbsp; Format&amp;nbsp; &amp;nbsp; Informat&amp;nbsp; &amp;nbsp;Label&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lmyers2_0-1616287206443.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56195i529AAABD4D90A3FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lmyers2_0-1616287206443.png" alt="lmyers2_0-1616287206443.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lmyers2_1-1616287269045.png" style="width: 411px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56196i8929D2A0FDA87B52/image-dimensions/411x35?v=v2" width="411" height="35" role="button" title="lmyers2_1-1616287269045.png" alt="lmyers2_1-1616287269045.png" /&gt;&lt;/span&gt;&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 want; set have;

length=year(datepart(EVRPRDTTM))-year(datepart(adate));

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The date is arranged in columns. There is only 1 row per patient.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;adate&amp;nbsp; &amp;nbsp; EVRPRDTTM&lt;/P&gt;&lt;P&gt;Patient 1&lt;/P&gt;&lt;P&gt;Patient 2&lt;/P&gt;&lt;P&gt;Patient 3...&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 00:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727965#M28245</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2021-03-21T00:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: subtracting 2 dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727969#M28246</link>
      <description>&lt;P&gt;Looks like ADATE is a date not a datetime variable so try this and switch to the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p1md4mx2crzfaqn14va8kt7qvfhr.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;INTCK&lt;/A&gt; function for greater accuracy:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;

length=intck('YEAR', adate, datepart(EVRPRDTTM), 'C');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 21 Mar 2021 01:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727969#M28246</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-21T01:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: subtracting 2 dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727971#M28247</link>
      <description>Thanks - what does the C do in the code?&lt;BR /&gt;</description>
      <pubDate>Sun, 21 Mar 2021 02:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727971#M28247</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2021-03-21T02:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: subtracting 2 dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727972#M28248</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165633"&gt;@lmyers2&lt;/a&gt;&amp;nbsp; - It's explained in the link I included (C = CONTINUOUS). If you still don't follow after reading that then please advise.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 02:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/727972#M28248</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-21T02:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: subtracting 2 dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/728247#M28269</link>
      <description>&lt;P&gt;The DATEPART() function is for converting datetime values (seconds) into date values (days).&amp;nbsp; It is essentially doing a MOD() operation with number of seconds in a day.&amp;nbsp; If you give a date value, like you are doing the result will be zero, which is 01JAN1960, since there are more seconds in a day than there are days since 1960 to now.&lt;/P&gt;
&lt;PRE&gt;1460  data _null_;
1461    today=date();
1462    day = '24:00't ;
1463    put (_all_) (=comma12.);
1464  run;

today=22,361 day=86,400
&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Mar 2021 18:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/subtracting-2-dates/m-p/728247#M28269</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-22T18:35:13Z</dc:date>
    </item>
  </channel>
</rss>

