<?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: Conversion of month in character to  numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449743#M113240</link>
    <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  month=month(input(catt('1',substr(birthmonth,1,3),'2018'),date9.));
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 19:14:00 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-03-29T19:14:00Z</dc:date>
    <item>
      <title>Conversion of month in character to  numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449740#M113235</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;So, I have a variable named Birthmonth which has Months in Character i.e January, February...etc&lt;/P&gt;&lt;P&gt;I want these to be converted into their respective numeric equals.&lt;/P&gt;&lt;P&gt;How to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 18:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449740#M113235</guid>
      <dc:creator>abhi18sas</dc:creator>
      <dc:date>2018-03-29T18:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of month in character to  numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449743#M113240</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  month=month(input(catt('1',substr(birthmonth,1,3),'2018'),date9.));
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449743#M113240</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-29T19:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of month in character to  numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449744#M113241</link>
      <description>&lt;P&gt;Here are two ways:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   select (birthmonth);
      when ('January')   monthnum=1;
      when ('February')  monthnum=2;
      when ('March')     monthnum=3;
      when ('April')     monthnum=4;
      when ('May')       monthnum=5;
      when ('June')      monthnum=6;
      when ('July')      monthnum=7;
      when ('August')    monthnum=8;
      when ('September') monthnum=9;
      when ('October')   monthnum=10;
      when ('November')  monthnum=11;
      when ('December')  monthnum=12;
      otherwise;
   end;
run;

data want;
   set have;
   birthmonth='January';
   array m(12) $ 15 _temporary_('January','February','March','April','May','June','July','August','September'
       'October','November','December') ;
  monthnum = whichc(birthmonth,of m(*));
run;
&lt;/PRE&gt;
&lt;P&gt;Both of these are case sensitive. So if your spelling changes case such as "MAY",&amp;nbsp;"May" and "may" you would want to use a case function on your variable (propcase(birthmonth) most likely)&amp;nbsp;and use the appropriate comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449744#M113241</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-29T19:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of month in character to  numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449851#M113271</link>
      <description>&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 04:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-month-in-character-to-numeric/m-p/449851#M113271</guid>
      <dc:creator>abhi18sas</dc:creator>
      <dc:date>2018-03-30T04:35:53Z</dc:date>
    </item>
  </channel>
</rss>

