<?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: formatting numeric to date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331448#M74491</link>
    <description>&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working in a VDI, so couldn't post the data and log information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did the same and it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do it with out concatenating 01?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Feb 2017 10:32:07 GMT</pubDate>
    <dc:creator>Haritha1</dc:creator>
    <dc:date>2017-02-10T10:32:07Z</dc:date>
    <item>
      <title>formatting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331445#M74488</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a data which has numeric variable in the follwing way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;01.2015&lt;/P&gt;&lt;P&gt;04.2015&lt;/P&gt;&lt;P&gt;06.2015&lt;/P&gt;&lt;P&gt;09.2015&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried converting it in to date format by using following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;format variable yymmn6.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting following&amp;nbsp;output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;196001&lt;/P&gt;&lt;P&gt;196001&lt;/P&gt;&lt;P&gt;196001&lt;/P&gt;&lt;P&gt;196001&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can any one please tell me the reason for the above output and how do I rectify the probem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks alot in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 10:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331445#M74488</guid>
      <dc:creator>Haritha1</dc:creator>
      <dc:date>2017-02-10T10:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: formatting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331446#M74489</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get a good answer it is recommended to post test data, in the form of a datastep (so we don't guess what you have), post output you want, and show code/logs of what does not work.&lt;/P&gt;
&lt;P&gt;I am guesssing 01.2015 is a character variable and means Jan 2015? &amp;nbsp;If so then you need to input it as a date, give it a default say 01, and then format it to what you want (SAS dates are all numeric, number of days since a certain timepoint):&lt;/P&gt;
&lt;PRE&gt;data want;
  my="01.2015";
  full_date=input(cats('01.',my),ddmmyy10.);
  format full_date yymmn6.;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2017 10:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331446#M74489</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-10T10:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: formatting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331448#M74491</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working in a VDI, so couldn't post the data and log information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did the same and it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do it with out concatenating 01?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 10:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331448#M74491</guid>
      <dc:creator>Haritha1</dc:creator>
      <dc:date>2017-02-10T10:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: formatting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331451#M74492</link>
      <description>&lt;P&gt;I don't know what a VDI is, but do bear in mind for future posts that this information helps us understand things at your end which we can't see.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, SAS dates have to be complete dates with Day Month and Year as they are stored as a number of days from a set date. &amp;nbsp;The format applied to this number can&amp;nbsp;&lt;U&gt;show&lt;/U&gt; the data slightly differently, but cannot alter the underlying data.&lt;/P&gt;
&lt;P&gt;Ie&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01JAN2015 = 20089 days &amp;lt;the number 20089 is what is stored in the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just want to display first part after second, then a cat and scan can do it (though always recommended to store dates as numeric dates, it just makes life easier):&lt;/P&gt;
&lt;PRE&gt;data want;
  my="01.2015";
  ym=cats(scan(my,2,"."),scan(my,1,"."));
run;&lt;/PRE&gt;
&lt;P&gt;That is string manipulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 10:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/formatting-numeric-to-date/m-p/331451#M74492</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-10T10:41:54Z</dc:date>
    </item>
  </channel>
</rss>

