<?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 Conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399868#M96874</link>
    <description>The Substr function worked for what I am trying to achieve in my coding. This populate the 2-digit month and 2 digit year from my current date format. Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;</description>
    <pubDate>Fri, 29 Sep 2017 18:00:21 GMT</pubDate>
    <dc:creator>tobyfarms</dc:creator>
    <dc:date>2017-09-29T18:00:21Z</dc:date>
    <item>
      <title>Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399577#M96794</link>
      <description>&lt;P&gt;I know there is a simple solution but I am having trouble finding it here..So if someone know where the solution is, can you&amp;nbsp;please just post the link.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to change the date format from '01JAN2017' to '0116'.&amp;nbsp;&amp;nbsp; The '01JAN2017' field is currently in numeric date9. format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 18:17:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399577#M96794</guid>
      <dc:creator>tobyfarms</dc:creator>
      <dc:date>2017-09-28T18:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399579#M96795</link>
      <description>&lt;P&gt;Change the format on this variable to MMDDYY4.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 18:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399579#M96795</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-09-28T18:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399594#M96800</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139205"&gt;@tobyfarms&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I know there is a simple solution but I am having trouble finding it here..So if someone know where the solution is, can you&amp;nbsp;please just post the link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to change the date format from '01JAN2017' to '0116'.&amp;nbsp;&amp;nbsp; The '01JAN2017' field is currently in numeric date9. format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Where does the 16 come from for 01Jan2017? If isn't a month number, a day number or any reasonable year value?&lt;/P&gt;
&lt;P&gt;If you mean 0101 for 01Jan2017 then &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;is correct.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 19:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399594#M96800</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-28T19:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399617#M96808</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;Sorry that was a mistake. I meant to have '0117', capturing the monthYear.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 20:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399617#M96808</guid>
      <dc:creator>tobyfarms</dc:creator>
      <dc:date>2017-09-28T20:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399633#M96810</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
format date mmyyn4.;
date='01jan2017'd;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 20:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399633#M96810</guid>
      <dc:creator>PBsas</dc:creator>
      <dc:date>2017-09-28T20:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399636#M96812</link>
      <description>&lt;P&gt;How about 2-digit year first, then 2-digit month?&amp;nbsp; If so, you can use the yymmdd format, truncated to 4 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;d='27sep2017'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;put d=yymmdd4.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;editted additon:&amp;nbsp; I didn't see a MMYY format, but &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/53881"&gt;@PBsas&lt;/a&gt;&amp;nbsp;did.&amp;nbsp; So you can ignore the below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really need MMYY, I don't see a MMYY format.&amp;nbsp; But you can make your own, using the PICTURE statement and the DATATYPE option, as in:&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;proc format;
  picture myformat (default=4)
    low-high = '%0m%0y' (datatype=date);
run;

data _null_;
  d=today();
  put d=myformat. ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 21:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399636#M96812</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-09-28T21:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399661#M96821</link>
      <description>&lt;P&gt;Why would you want the value in MMYY order? That will not sort properly and would be very confusing. Why YYMM?&lt;/P&gt;
&lt;P&gt;Do you want a string?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;str = substr(put(date,ddmmyy6.),3,4);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A number?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;numb = month(date)+100 + year(date)-2000 ;
format numb z4. ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If a number do want to store the actual date and just attach a format?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
 picture mydt other='%0m%0y' (datatype=date);
run;
....
format date mydt4.;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 23:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399661#M96821</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-28T23:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399668#M96823</link>
      <description>&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  today=today();
format today MMYYN4.;
PUT TODAY;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 01:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399668#M96823</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-29T01:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399868#M96874</link>
      <description>The Substr function worked for what I am trying to achieve in my coding. This populate the 2-digit month and 2 digit year from my current date format. Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;</description>
      <pubDate>Fri, 29 Sep 2017 18:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/399868#M96874</guid>
      <dc:creator>tobyfarms</dc:creator>
      <dc:date>2017-09-29T18:00:21Z</dc:date>
    </item>
  </channel>
</rss>

