<?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 Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786228#M250990</link>
    <description>I have a data which has the following date values in numeric type variable,the format is best6.&lt;BR /&gt;Date&lt;BR /&gt;201304&lt;BR /&gt;201406&lt;BR /&gt;201409&lt;BR /&gt;201412&lt;BR /&gt;201311&lt;BR /&gt;&lt;BR /&gt;I want to change it format and want the following result&lt;BR /&gt;New_Date&lt;BR /&gt;2013/04&lt;BR /&gt;2014/06&lt;BR /&gt;2014/09&lt;BR /&gt;2014/12&lt;BR /&gt;2013/11&lt;BR /&gt;</description>
    <pubDate>Wed, 15 Dec 2021 19:41:04 GMT</pubDate>
    <dc:creator>Dg112</dc:creator>
    <dc:date>2021-12-15T19:41:04Z</dc:date>
    <item>
      <title>Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786228#M250990</link>
      <description>I have a data which has the following date values in numeric type variable,the format is best6.&lt;BR /&gt;Date&lt;BR /&gt;201304&lt;BR /&gt;201406&lt;BR /&gt;201409&lt;BR /&gt;201412&lt;BR /&gt;201311&lt;BR /&gt;&lt;BR /&gt;I want to change it format and want the following result&lt;BR /&gt;New_Date&lt;BR /&gt;2013/04&lt;BR /&gt;2014/06&lt;BR /&gt;2014/09&lt;BR /&gt;2014/12&lt;BR /&gt;2013/11&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Dec 2021 19:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786228#M250990</guid>
      <dc:creator>Dg112</dc:creator>
      <dc:date>2021-12-15T19:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786229#M250991</link>
      <description>&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;data have;
   input Date;
datalines;
201304
201406
201409
201412
201311
;

data want;
   set have;
   new_date = input(put(date,f6.),yymmn6.);
   format new_date yymms7.;
run;&lt;/PRE&gt;
&lt;P&gt;Input works with character values so need to use the Put function to create such and the yymmn informat reads year month values.&lt;/P&gt;
&lt;P&gt;Note that the New_date variable will have a presumed day of the month of 1.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 19:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786229#M250991</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-15T19:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786230#M250992</link>
      <description>&lt;P&gt;In SAS the word FORMAT means the instructions for how to convert the values into text, for example when printing the values in a report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has only two types of variables floating point numbers and fixed length character strings.&amp;nbsp; Your original values are numbers, like 201,304 or 201,412.&amp;nbsp; SAS stores DATE values as the number of days since 1960, so over 200 thousand days would be almost 500 years into the future.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So do you want to convert those numbers into character strings? Or date values?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input date;
cards;
201304
201406
201409
201412
201311
;

data want;
  set have;
  length new_date $7. date_value 8;
  new_date=put(date,z6.);
  new_date=catx('/',substr(new_date,1,4),substr(new_date,5));
  date_value=input(put(date,z6.),yymmn6.);
  format date_value YYMMS7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 20:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/786230#M250992</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-15T20:00:07Z</dc:date>
    </item>
  </channel>
</rss>

