<?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: Date difference in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426692#M105157</link>
    <description>&lt;P&gt;Not possible.&amp;nbsp; Give one example of the inputs and outputs that&amp;nbsp;you believe to be incorrect.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2018 21:51:05 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-01-10T21:51:05Z</dc:date>
    <item>
      <title>Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426683#M105151</link>
      <description>&lt;P&gt;Hey guys;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get days difference between two dates in the format&amp;nbsp;YYMMDDN8.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data M.Master;
set M.Master;
by DESY_SORT_KEY;
Day_Death = intck('dtday', Index, DEATH_DT);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Every row has same days, Can you guys help me out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 21:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426683#M105151</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-01-10T21:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426685#M105153</link>
      <description>&lt;P&gt;If you have two dates, you don't need INTCK:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Day_Death = Death_DT - Index;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 21:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426685#M105153</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-10T21:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426691#M105156</link>
      <description>&lt;P&gt;I tried it, but I'm ending up getting a date format output instead of numeric days.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 21:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426691#M105156</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-01-10T21:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426692#M105157</link>
      <description>&lt;P&gt;Not possible.&amp;nbsp; Give one example of the inputs and outputs that&amp;nbsp;you believe to be incorrect.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 21:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426692#M105157</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-10T21:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426704#M105164</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Not possible.&amp;nbsp; Give one example of the inputs and outputs that&amp;nbsp;you believe to be incorrect.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Perhaps the data set already has a variable Day_Death with a date format from a previous trial of this code exercise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&lt;/P&gt;
&lt;P&gt;Data M.Master;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set M.Master;&lt;/P&gt;
&lt;P&gt;coding could well have added lots of things in prior runs such as FORMAT for Day_death.&lt;/P&gt;
&lt;P&gt;Also use of '&lt;STRONG&gt;dtday&lt;/STRONG&gt;' also implies that you should have DATETIME variables, not Dates. So try 'day' instead or the subtraction.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;You may want to&amp;nbsp;go back and rebuild the M.Master set to before you attempted to add this variable the first time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 22:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426704#M105164</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-10T22:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426706#M105165</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data M.Master;
set M.Master;
by DESY_SORT_KEY;
format DEATH_DT YYMMDDN8.;
format Index YYMMDDN8.;
if DEATH_DT NE "" then Death = 1;
Day_Death = (DEATH_DT - Index);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 228px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17774iBF3153C6F4CAB04E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 22:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426706#M105165</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-01-10T22:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426713#M105168</link>
      <description>&lt;P&gt;Looking at these results, I would guess &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;hit the nail on the head.&amp;nbsp; Your existing data set already contains a variable named DAY_Death, and it already has a date format.&amp;nbsp; One easy way to get rid of that would be on the SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set M.Master (drop=Day_Death);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That assumes you have inspected the data and agree that you want to get rid of it.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 22:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426713#M105168</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-10T22:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426744#M105176</link>
      <description>&lt;P&gt;It would also be interesting to see what the actual assigned format for the DAY_death variable is. In a value like 20101717 while 2010 might be a year the 1717 is not a valid month and day combination in any form, there is no month 17 in SAS dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And without a shown value for INDEX I'm at loss for what is happening.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 01:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426744#M105176</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-11T01:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426882#M105219</link>
      <description>&lt;P&gt;Day_Death is created to calculate the days difference between days and don't&amp;nbsp;exist before.&lt;/P&gt;&lt;P&gt;Index date originally was in the format&amp;nbsp;YYMMDDN8. and DEATH_DT was in the format BEST12.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426882#M105219</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-01-11T14:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Date difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426893#M105223</link>
      <description>&lt;P&gt;The internal numeric representation of a date corresponding to your Death_dt of 20130420 (20APR2013) is 19468. To have a value of&lt;/P&gt;
&lt;P&gt;death_dt - index = 20111309 as shown above then Index would have to have a value of &lt;STRONG&gt;-&lt;/STRONG&gt;20091841 which has a value prior to the earliest valid SAS date values (by about 19700000 days). HOWEVER that value of Index would correspond to a datetime of 13MAY59:10:55:59.&lt;/P&gt;
&lt;P&gt;If index is supposed to be 20120428 (28APR2012) then your value of Death_dt is 20130420 and is not a SAS date variable at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what is the actual value of your Index variable? and if the SAS format assigned is actually YYMMDDN8. then show the unformatted values for Death_dt and Index for a few records.&lt;/P&gt;
&lt;P&gt;Proc print data=have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var death_dt index;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format death_dt index&amp;nbsp; best12.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;for example.&lt;/P&gt;
&lt;P&gt;I believe from what you have shown that at least one of your variables does not actually have the SAS format you&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 15:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-difference/m-p/426893#M105223</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-11T15:28:23Z</dc:date>
    </item>
  </channel>
</rss>

