<?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: Difference between two different format dates. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512773#M138128</link>
    <description>When I did it with the correct formulas it worked perfectly. &lt;BR /&gt;&lt;BR /&gt;When you say something isn’t working, show your code. I suspect you still have two indexes in your code. The original code, without the N in the format and with only one index is still correct. If that doesn’t work post your full code and log.</description>
    <pubDate>Tue, 13 Nov 2018 22:24:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-13T22:24:18Z</dc:date>
    <item>
      <title>Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512315#M137953</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've two variables DEATH_DT with format&amp;nbsp;BEST12. and INDEX with format&amp;nbsp;YYMMDDN8. I tried&amp;nbsp;following&amp;nbsp;to get dates difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data M.Death;
set M.Death;
format DEATH_Date YYMMDDN8.;
DEATH_Date = DEATH_DT;
&lt;BR /&gt;death_days = (DEATH_Date-Index);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Surprisingly the outcome of death_days is also date with format&amp;nbsp;BEST12. I highly appreciate if someone could help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 19:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512315#M137953</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-12T19:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512321#M137958</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've two variables &lt;FONT color="#800080"&gt;&lt;STRONG&gt;DEATH_DT with format&amp;nbsp;BEST12.&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;STRONG&gt;&lt;FONT color="#800080"&gt;INDEX with format&amp;nbsp;YYMMDDN8.&lt;/FONT&gt;&lt;/STRONG&gt; I tried&amp;nbsp;following&amp;nbsp;to get dates difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A 'date' with a best12 format will not be a SAS date and you cannot do a subtraction and expect the correct value, assuming it looks like YYMMDD, ie 20180101 as a number. You will first need to convert it to a date and then use it. However the exact code depends on how the variable looks like (the informal to use) and you would need to provide that information Your code would end up looking like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;death_sas_date = input(put(death_dt, 8. -l), yymmdd10.);

death_days = death_sas_date - Index;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 20:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512321#M137958</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-12T20:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512323#M137959</link>
      <description>&lt;P&gt;Can you show us the values on at least one observation of variables DEATH_DT and INDEX? Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 20:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512323#M137959</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-12T20:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512325#M137960</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've two variables &lt;FONT color="#800080"&gt;&lt;STRONG&gt;DEATH_DT with format&amp;nbsp;BEST12.&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;STRONG&gt;&lt;FONT color="#800080"&gt;INDEX with format&amp;nbsp;YYMMDDN8.&lt;/FONT&gt;&lt;/STRONG&gt; I tried&amp;nbsp;following&amp;nbsp;to get dates difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A 'date' with a best12 format will not be a SAS date&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sure it can be a SAS date. Formats don't change whether or not something is a SAS date.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 20:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512325#M137960</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-12T20:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512339#M137970</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've two variables &lt;FONT color="#800080"&gt;&lt;STRONG&gt;DEATH_DT with format&amp;nbsp;BEST12.&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;STRONG&gt;&lt;FONT color="#800080"&gt;INDEX with format&amp;nbsp;YYMMDDN8.&lt;/FONT&gt;&lt;/STRONG&gt; I tried&amp;nbsp;following&amp;nbsp;to get dates difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A 'date' with a best12 format will not be a SAS date&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sure it can be a SAS date. Formats don't change whether or not something is a SAS date.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;A 'date' with a best12 format will not be a SAS date and you cannot do a subtraction and expect the correct value, &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;assuming it looks like YYMMDD, ie 20180101 as a number&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I stand by that statement &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; If it's a number and looks like YYMMDD (20180101) with the BEST format it's 99% unlikely to be a SAS date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If it was 21048 that's likely a SAS date.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 20:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512339#M137970</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-12T20:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512342#M137972</link>
      <description>&lt;P&gt;First column is the DEATH_DT with format&amp;nbsp;BEST12. Length 8 and Informat 12.&lt;/P&gt;&lt;P&gt;Second column is the INDEX with format&amp;nbsp;YYMMDDN8. Length 8 and informat 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why the date is in a non-SAS format because it's the original datasets&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Death.PNG" style="width: 224px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24832i740378950CA2904C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Death.PNG" alt="Death.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 20:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512342#M137972</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-12T20:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512346#M137976</link>
      <description>&lt;P&gt;Given this, the code I posted earlier should work. If it does not, post your code and log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;First column is the DEATH_DT with format&amp;nbsp;BEST12. Length 8 and Informat 12.&lt;/P&gt;
&lt;P&gt;Second column is the INDEX with format&amp;nbsp;YYMMDDN8. Length 8 and informat 8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know why the date is in a non-SAS format because it's the original datasets&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Death.PNG" style="width: 224px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24832i740378950CA2904C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Death.PNG" alt="Death.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 21:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512346#M137976</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-12T21:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512411#M138001</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;I tried the code but it's throwing error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Death.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24857i832709015EA34D03/image-size/large?v=v2&amp;amp;px=999" role="button" title="Death.PNG" alt="Death.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried changing the YYMMDDN10. to&amp;nbsp;&lt;SPAN&gt;YYMMDDN8. I had the same error.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 22:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512411#M138001</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-12T22:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512446#M138027</link>
      <description>&lt;P&gt;Read &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s post thoroughly, with regards to the informat. There is no yymmddn&amp;nbsp;&lt;EM&gt;informat&lt;/EM&gt;, it only exists as&amp;nbsp;&lt;EM&gt;format&lt;/EM&gt;. Use the yymmdd informat.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 04:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512446#M138027</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-13T04:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512512#M138057</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've two variables &lt;FONT color="#800080"&gt;&lt;STRONG&gt;DEATH_DT with format&amp;nbsp;BEST12.&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;STRONG&gt;&lt;FONT color="#800080"&gt;INDEX with format&amp;nbsp;YYMMDDN8.&lt;/FONT&gt;&lt;/STRONG&gt; I tried&amp;nbsp;following&amp;nbsp;to get dates difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A 'date' with a best12 format will not be a SAS date&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sure it can be a SAS date. Formats don't change whether or not something is a SAS date.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;A 'date' with a best12 format will not be a SAS date and you cannot do a subtraction and expect the correct value, &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;assuming it looks like YYMMDD, ie 20180101 as a number&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I stand by that statement &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; If it's a number and looks like YYMMDD (20180101) with the BEST format it's 99% unlikely to be a SAS date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If it was 21048 that's likely a SAS date.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Up until a later post, there was no such statement by the original poster that "it looks like YYMMDD", and so this (at the time) is an unsupported assumption.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 11:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512512#M138057</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-13T11:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512513#M138058</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;I tried the code but it's throwing error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Death.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24857i832709015EA34D03/image-size/large?v=v2&amp;amp;px=999" role="button" title="Death.PNG" alt="Death.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried changing the YYMMDDN10. to&amp;nbsp;&lt;SPAN&gt;YYMMDDN8. I had the same error.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please copy and paste the SASLOG as text (not as an image) into the {i} window.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 11:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512513#M138058</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-13T11:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512560#M138074</link>
      <description>&lt;P&gt;My bad &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, I corrected the code as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;posted&amp;nbsp;&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 M.Death;
set M.Death;
  Death_SAS_Date = input(put(DEATH_DT, 8. -l), YYMMDD10.) - Index;
  Death_days = Death_SAS_Date - Index;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Death_SAS_Date still in the format of&amp;nbsp;BEST12. and Death_days are also in the format of&amp;nbsp;BEST12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Death.PNG" style="width: 425px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24865iF46C85A5BA033458/image-size/large?v=v2&amp;amp;px=999" role="button" title="Death.PNG" alt="Death.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 14:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512560#M138074</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-13T14:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512633#M138084</link>
      <description>&lt;P&gt;Post the dataset&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;in a data step with datalines&lt;/EM&gt;&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Until we can know your data (see Maxim 3), further guessing around is useless.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 16:45:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512633#M138084</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-13T16:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512672#M138097</link>
      <description>&lt;PRE&gt;data WORK.DEATH;
  infile datalines dsd truncover;
  input DEATH_DT:32. Index:YYMMDDN8.;
  format Index YYMMDDN8.;
  label Index="Claim Admission Date";
datalines;
. 20120910
. 20120801
. 20120927
20140520 20120809
. 20121019
. 20120103
. 20120731
. 20120308
20150121 20120109
. 20121005
;;;;&lt;/PRE&gt;&lt;P&gt;Does this help&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 18:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512672#M138097</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-13T18:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512692#M138100</link>
      <description>&lt;PRE&gt;  Death_SAS_Date = input(put(DEATH_DT, 8. -l), YYMMDD10.)&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; - Index&lt;/STRONG&gt;&lt;/FONT&gt;;
  Death_days = Death_SAS_Date - &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Index&lt;/STRONG&gt;&lt;/FONT&gt;;&lt;/PRE&gt;
&lt;P&gt;You're subtracting the index twice. You can literally copy and paste my previous code to get this right.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;My bad &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, I corrected the code as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;posted&amp;nbsp;&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 M.Death;
set M.Death;
  Death_SAS_Date = input(put(DEATH_DT, 8. -l), YYMMDD10.) - Index;
  Death_days = Death_SAS_Date - Index;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Death_SAS_Date still in the format of&amp;nbsp;BEST12. and Death_days are also in the format of&amp;nbsp;BEST12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Death.PNG" style="width: 425px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24865iF46C85A5BA033458/image-size/large?v=v2&amp;amp;px=999" role="button" title="Death.PNG" alt="Death.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 19:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512692#M138100</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-13T19:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512735#M138114</link>
      <description>&lt;P&gt;I&amp;nbsp;corrected but it still gives the same output&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 20:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512735#M138114</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-13T20:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512773#M138128</link>
      <description>When I did it with the correct formulas it worked perfectly. &lt;BR /&gt;&lt;BR /&gt;When you say something isn’t working, show your code. I suspect you still have two indexes in your code. The original code, without the N in the format and with only one index is still correct. If that doesn’t work post your full code and log.</description>
      <pubDate>Tue, 13 Nov 2018 22:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512773#M138128</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-13T22:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512850#M138161</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94658"&gt;@Sujithpeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;data WORK.DEATH;
  infile datalines dsd truncover;
  input DEATH_DT:32. Index:YYMMDDN8.;
  format Index YYMMDDN8.;
  label Index="Claim Admission Date";
datalines;
. 20120910
. 20120801
. 20120927
20140520 20120809
. 20121019
. 20120103
. 20120731
. 20120308
20150121 20120109
. 20121005
;;;;&lt;/PRE&gt;
&lt;P&gt;Does this help&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Testing code before posting it here is not a crime, so please do it. You once again committed the mistake of using a non-existing informat that I already advised you about.&lt;/P&gt;
&lt;P&gt;After fixing the data step, it can be clearly proven that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s code as initially posted works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.DEATH;
input DEATH_DT :32. Index :YYMMDD8.;
format Index YYMMDDN8.;
label Index="Claim Admission Date";
datalines4;
. 20120910
. 20120801
. 20120927
20140520 20120809
. 20121019
. 20120103
. 20120731
. 20120308
20150121 20120109
. 20121005
;;;;
run;

data Death;
set Death;
format death_sas_date yymmddn8.;
death_sas_date = input(put(death_dt, 8. -l), yymmdd10.);
death_days = death_sas_date - Index;
run;

proc print data=death noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;                         death_     death_
DEATH_DT       Index    sas_date     days

       .    20120910           .        . 
       .    20120801           .        . 
       .    20120927           .        . 
20140520    20120809    20140520      649 
       .    20121019           .        . 
       .    20120103           .        . 
       .    20120731           .        . 
       .    20120308           .        . 
20150121    20120109    20150121     1108 
       .    20121005           .        . 
&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Nov 2018 07:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512850#M138161</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-14T07:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two different format dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512949#M138194</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;thanks guys, I apologize for not properly following the instructions.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 14:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-different-format-dates/m-p/512949#M138194</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-11-14T14:16:06Z</dc:date>
    </item>
  </channel>
</rss>

