<?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: SAS Date MMYYYY in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93007#M26455</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin, If you have 9.3 you could use a format based on a function. Regards Jeroen. proc fcmp outlib=work.functions.smd;&amp;nbsp;&amp;nbsp; function MonYear(date) $ 8; month = floor(date / 10000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year&amp;nbsp; = date - (month * 10000); if month &amp;lt; 1 or month &amp;gt; 12 then do; month = 1; end; return (catx(' ', put(mdy(month, 1, year), monname3.), put(year, 4.)));&amp;nbsp;&amp;nbsp; endsub; run; /* Make the function available to SAS. */ options cmplib=(work.functions); /* Create a format using the function created by the FCMP procedure. */ proc format;&amp;nbsp;&amp;nbsp; value MonYear&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; other=[MonYear()]; run; /* Use the format in a SAS program.&amp;nbsp; */ data test;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input testdate;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines; 12011 022012 122013 ; run; proc print data=test; format testdate MonYear.; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Oct 2012 10:30:48 GMT</pubDate>
    <dc:creator>Jeroen</dc:creator>
    <dc:date>2012-10-12T10:30:48Z</dc:date>
    <item>
      <title>SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93004#M26452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I format a numeric field (i.e. 102012) as Oct 2012?&lt;/P&gt;&lt;P&gt;I basically want to show the month (Oct) plus the year (2012).&amp;nbsp; Is this possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for any input! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 00:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93004#M26452</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2012-10-12T00:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93005#M26453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&amp;nbsp; fornat&amp;nbsp; &lt;STRONG&gt;nldateym8.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 01:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93005#M26453</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-10-12T01:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93006#M26454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need customize it on your own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;proc&amp;nbsp; format ;
picture fmt(default=8)
 other='%b%Y'(datatype=date);
run;

data _null_;
a=23234;
format a fmt.;
put a= ;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 06:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93006#M26454</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-10-12T06:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93007#M26455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin, If you have 9.3 you could use a format based on a function. Regards Jeroen. proc fcmp outlib=work.functions.smd;&amp;nbsp;&amp;nbsp; function MonYear(date) $ 8; month = floor(date / 10000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year&amp;nbsp; = date - (month * 10000); if month &amp;lt; 1 or month &amp;gt; 12 then do; month = 1; end; return (catx(' ', put(mdy(month, 1, year), monname3.), put(year, 4.)));&amp;nbsp;&amp;nbsp; endsub; run; /* Make the function available to SAS. */ options cmplib=(work.functions); /* Create a format using the function created by the FCMP procedure. */ proc format;&amp;nbsp;&amp;nbsp; value MonYear&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; other=[MonYear()]; run; /* Use the format in a SAS program.&amp;nbsp; */ data test;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input testdate;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines; 12011 022012 122013 ; run; proc print data=test; format testdate MonYear.; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 10:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93007#M26455</guid>
      <dc:creator>Jeroen</dc:creator>
      <dc:date>2012-10-12T10:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93008#M26456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Jeroen.&amp;nbsp; Unfortunately we use 9.1.&amp;nbsp; Thank you for your response &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 15:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93008#M26456</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2012-10-12T15:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93009#M26457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ksharp,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your suggestion!&amp;nbsp; It worked.&amp;nbsp; But now I realize I need the result in a different format.&lt;/P&gt;&lt;P&gt;I actually need 02012 as OCT-12.&lt;/P&gt;&lt;P&gt;I modified your code as below and came up withAUG12.&amp;nbsp; Is it possible to add a '-' between AUG and 12? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again for your help! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc&amp;nbsp; format ;&lt;/P&gt;&lt;P&gt;picture fmt(default=5)&lt;/P&gt;&lt;P&gt; other='%b%y'(datatype=date);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;a=23234;&lt;/P&gt;&lt;P&gt;format a fmt.;&lt;/P&gt;&lt;P&gt;put a= ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 15:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93009#M26457</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2012-10-12T15:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MMYYYY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93010#M26458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;proc&amp;nbsp; format ;
picture fmt(default=8)
 other='%b-%0y'(datatype=date);
run;

data _null_;
a=18234;
format a fmt.;
put a= ;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2012 02:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Date-MMYYYY/m-p/93010#M26458</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-10-16T02:02:59Z</dc:date>
    </item>
  </channel>
</rss>

