<?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: How can I cahnege the no into date ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501768#M133833</link>
    <description>&lt;P&gt;The conversion is easier done in a strictly numeric manner:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
number = 198704;
date = mdy(mod(number,100),1,int(number/100));
format date yymmddd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Avoids all the fiddling around with formats and informats.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Oct 2018 07:49:15 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-10-05T07:49:15Z</dc:date>
    <item>
      <title>How can I cahnege the no into date ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501765#M133831</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to change the no 198704 to a SAS date, where 1987 is Year and 04 is month.&lt;/P&gt;&lt;P&gt;Actually I want to calculate the difference (L.O.R)&amp;nbsp; b/w to Date2 and Date1 in months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please tell me where is I am mistaking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data abc;&lt;BR /&gt;set ab1;&lt;BR /&gt;Date1_changed = put(input(put(Date1,6.),yymmn6.),yymmn6.);&lt;BR /&gt;Date2_changed = put(input(put(Date2,6.),yymmn6.),yymmn6.);&lt;BR /&gt;LOR = intck('Months',date1, date2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set - ab1&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0" border="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date1&lt;/TD&gt;&lt;TD&gt;Date2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;198704&lt;/TD&gt;&lt;TD&gt;201106&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;200601&lt;/TD&gt;&lt;TD&gt;201103&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;198709&lt;/TD&gt;&lt;TD&gt;200901&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;201307&lt;/TD&gt;&lt;TD&gt;201307&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;201310&lt;/TD&gt;&lt;TD&gt;201310&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;199411&lt;/TD&gt;&lt;TD&gt;200412&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;199308&lt;/TD&gt;&lt;TD&gt;200306&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;200607&lt;/TD&gt;&lt;TD&gt;201304&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 07:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501765#M133831</guid>
      <dc:creator>vishalrajpoot3</dc:creator>
      <dc:date>2018-10-05T07:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I cahnege the no into date ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501767#M133832</link>
      <description>&lt;P&gt;A SAS numeric date&amp;nbsp;&lt;STRONG&gt;has&lt;/STRONG&gt; to have all three parts - year, month, and day.&amp;nbsp; Irrespective of if you format it as month/year only it still needs the day.&amp;nbsp; This is because the value behind is actually number of days since the cuttoff.&amp;nbsp; So you would need something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set ab1;
  date_1=mdy(input(substr(date,5,2),best.),1, input(substr(date,1,4),best.));
  format date_1 yymmn6.;
run;&lt;/PRE&gt;
&lt;P&gt;Or more simply using an informat:&lt;/P&gt;
&lt;PRE&gt;data want;
  set ab1;
  date_1=input(date,yymmn6.);
  format date_1 yymmn6.;
run;&lt;/PRE&gt;
&lt;P&gt;Not tested,&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;post test data in the form of a datastep in future!&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 07:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501767#M133832</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-05T07:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can I cahnege the no into date ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501768#M133833</link>
      <description>&lt;P&gt;The conversion is easier done in a strictly numeric manner:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
number = 198704;
date = mdy(mod(number,100),1,int(number/100));
format date yymmddd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Avoids all the fiddling around with formats and informats.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 07:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-cahnege-the-no-into-date/m-p/501768#M133833</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-05T07:49:15Z</dc:date>
    </item>
  </channel>
</rss>

