<?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: Not able to do date difference in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743853#M29270</link>
    <description>Variable Type Len Format Informat&lt;BR /&gt;starting_date Char 6 $6. $6.&lt;BR /&gt;last_date Char 6 $6. $6.&lt;BR /&gt;</description>
    <pubDate>Wed, 26 May 2021 13:01:37 GMT</pubDate>
    <dc:creator>ash3</dc:creator>
    <dc:date>2021-05-26T13:01:37Z</dc:date>
    <item>
      <title>Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743842#M29264</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;starting_ date&lt;/TD&gt;&lt;TD&gt;last _date&lt;/TD&gt;&lt;TD&gt;difference&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Dec-11&lt;/TD&gt;&lt;TD&gt;Jan-15&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Dec-11&lt;/TD&gt;&lt;TD&gt;Apr-13&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Dec-11&lt;/TD&gt;&lt;TD&gt;Jan-16&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have ;&lt;BR /&gt;difference = intck("month",starting_date,last_date);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I am getting missing values in difference column using the above code. please help me how I get difference between&amp;nbsp;starting_date and last_date&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 12:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743842#M29264</guid>
      <dc:creator>ash3</dc:creator>
      <dc:date>2021-05-26T12:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743845#M29265</link>
      <description>&lt;P&gt;Dec-11 is not a date, because in SAS, a date is an integer representing the number of days since 01JAN1960. Furthermore, you may have a formatted date, in which case Dec-11 might be a formatted date representing 01DEC2011, but that's a wild guess, and it could be a lot of other things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To further debug this situation, you would need to provide a portion of your original data following these instructions:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then we can be sure that we have a complete and unambiguous understanding of what Dec-11 represents, and so we can then help further.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 12:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743845#M29265</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-26T12:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743848#M29267</link>
      <description>So how do I convert Dec-11 to 01Dec2011?</description>
      <pubDate>Wed, 26 May 2021 12:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743848#M29267</guid>
      <dc:creator>ash3</dc:creator>
      <dc:date>2021-05-26T12:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743849#M29268</link>
      <description>&lt;P&gt;I don't know what Dec-11 means, I don't know if this is formatted, and you need to provide a portion of your actual data following the instructions I gave. This will clear up the matter unambiguously.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 12:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743849#M29268</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-26T12:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743851#M29269</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/215758"&gt;@ash3&lt;/a&gt;&amp;nbsp;You have to process it using conditional statement and character function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming "starting_date" and "&amp;nbsp;last_date" contains Month and Year.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;steps you can follow.&lt;/P&gt;
&lt;P&gt;1. Create two column with the delimiter "-" for starting_date as Month and Year column. (Same process for for&amp;nbsp;last_date).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. For Month column apply If statement like if Month eq 'Jan' then Month_1=01; (for all the months)&lt;/P&gt;
&lt;P&gt;3. Concatenate it as '01'(hard coded) -&amp;gt; cats('01','-',Month_1,'-',Year);&lt;/P&gt;
&lt;P&gt;3. convert Final variable in Num type and apply your difference logic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;SS&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 13:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743851#M29269</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2021-05-26T13:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743853#M29270</link>
      <description>Variable Type Len Format Informat&lt;BR /&gt;starting_date Char 6 $6. $6.&lt;BR /&gt;last_date Char 6 $6. $6.&lt;BR /&gt;</description>
      <pubDate>Wed, 26 May 2021 13:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743853#M29270</guid>
      <dc:creator>ash3</dc:creator>
      <dc:date>2021-05-26T13:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743859#M29271</link>
      <description>&lt;P&gt;So you don't have SAS dates, you have a character string that looks like a date to humans.&amp;nbsp;This is something you have to know before you begin trying to write a program because the function INTCK will not work on character strings. The INPUT function will convert character strings to actual numeric SAS dates, and then INTCK will work on the actual numeric SAS dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    date1='Dec-11';
    date2='May-15';
run;

data want;
    set have;
    ndate1=input(compress(date1,'-'),monyy.);
    ndate2=input(compress(date2,'-'),monyy.);
    difference=intck('month',ndate1,ndate2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 13:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743859#M29271</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-26T13:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to do date difference</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743863#M29272</link>
      <description>Thank you very much</description>
      <pubDate>Wed, 26 May 2021 13:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-do-date-difference/m-p/743863#M29272</guid>
      <dc:creator>ash3</dc:creator>
      <dc:date>2021-05-26T13:20:24Z</dc:date>
    </item>
  </channel>
</rss>

