<?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/270044#M53587</link>
    <description>&lt;P&gt;All SAS products require that a date variable contain a full date or nothing. &amp;nbsp;You can still format the data to display month and year, but underneath the data will still be a full date:&lt;/P&gt;
&lt;PRE&gt;data want;
  in_date="201305";
  processed_date=input(cats(in_date,"01"),yymmdd8.);
  format processed_date mmyy9.;
  character_date=cats(put(processed_date,monname.),'/',year(processed_date));
run;&lt;/PRE&gt;
&lt;P&gt;Now you want a specific type of output not covered by the basic formats:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could either look into creating a picture format to create your own format, or my personal preference is create a text variable with the result.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2016 13:22:45 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-05-12T13:22:45Z</dc:date>
    <item>
      <title>Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270039#M53584</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I'm new in SAS, Plz help me with the following issue.&lt;/P&gt;&lt;P&gt;I'm trying to convert Date format in SAS EG&lt;/P&gt;&lt;P&gt;Scenario is&lt;/P&gt;&lt;P&gt;Month Date is given &amp;nbsp;: 201305&lt;/P&gt;&lt;P&gt;Output i want : May/2013&lt;/P&gt;&lt;P&gt;I tried below expresssion&lt;/P&gt;&lt;P&gt;Input(substr(YEAR_MTH,5,2) ||"/"|| substr(YEAR_MTH,1,4), mmyy7.)&lt;/P&gt;&lt;P&gt;Still not able to get the output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12536iE0EFFD9ACBAF4B22/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="DateError.PNG" title="DateError.PNG" /&gt;</description>
      <pubDate>Thu, 12 May 2016 12:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270039#M53584</guid>
      <dc:creator>ImVickie</dc:creator>
      <dc:date>2016-05-12T12:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270044#M53587</link>
      <description>&lt;P&gt;All SAS products require that a date variable contain a full date or nothing. &amp;nbsp;You can still format the data to display month and year, but underneath the data will still be a full date:&lt;/P&gt;
&lt;PRE&gt;data want;
  in_date="201305";
  processed_date=input(cats(in_date,"01"),yymmdd8.);
  format processed_date mmyy9.;
  character_date=cats(put(processed_date,monname.),'/',year(processed_date));
run;&lt;/PRE&gt;
&lt;P&gt;Now you want a specific type of output not covered by the basic formats:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could either look into creating a picture format to create your own format, or my personal preference is create a text variable with the result.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 13:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270044#M53587</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-12T13:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270046#M53588</link>
      <description>&lt;P&gt;Try this:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;%let mon=201305;&lt;BR /&gt;&amp;nbsp;%let mon = %sysfunc( intnx( month , %sysfunc( inputn( &amp;amp;mon. , yymmn6. ) ) , 0 ) , date9. ) ;&lt;BR /&gt;&amp;nbsp;%let want=%sysfunc(catx(/,%sysfunc(substr(&amp;amp;mon,3,3)),%sysfunc(substr(&amp;amp;mon,6,4))));&lt;BR /&gt;&amp;nbsp;%put &amp;amp;want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 13:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270046#M53588</guid>
      <dc:creator>Rushikesh</dc:creator>
      <dc:date>2016-05-12T13:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270048#M53590</link>
      <description>&lt;P&gt;Hi ImVickie,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yo don't mention whether this is a character or numeric 201305. The code shows how to do this with character but with the numeric option commented out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;BR /&gt; * daten = 201305;&lt;BR /&gt; * sasd = input(put(daten,6.),yymmn6.);&lt;BR /&gt; datec = '201305';&lt;BR /&gt; sasd = input(datec,yymmn6.);&lt;BR /&gt; newdt = put(month(sasd),monname3.)!!'/'!!PUT(Year(sasd),4.);&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it's what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 13:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Conversion/m-p/270048#M53590</guid>
      <dc:creator>BPD</dc:creator>
      <dc:date>2016-05-12T13:34:45Z</dc:date>
    </item>
  </channel>
</rss>

