<?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: MONNAME(MONTH(tbl.field_name)) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308880#M66352</link>
    <description>&lt;P&gt;You don't need to convert anything, if your variable is a SAS date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
	date_var='01Nov2016'd;
	format date_var date9.;
	month_name=put(date_var, monname.);
run;

proc print ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 Nov 2016 21:03:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-11-02T21:03:56Z</dc:date>
    <item>
      <title>How to get month as name from a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308834#M66336</link>
      <description>&lt;P&gt;I am trying to use this and not getting anywhere.&amp;nbsp; Any help on how to use this would be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using MONTH(tbl.field_name) to pull the month out i.e.... 1, 2, 3 etc... 12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I was using MONNAME to get the desired result 1 = January&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code that I am using now:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SELECT (MONTH(t2.Sale_Date)) LENGTH=9 LABEL="Sale_Month" AS Sale_Month,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 21:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308834#M66336</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-02T21:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308850#M66340</link>
      <description>&lt;P&gt;What do the values of sale_date look like? Are they character or numeric?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 19:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308850#M66340</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-11-02T19:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308854#M66342</link>
      <description>I do not have it specified..... should I have it as a char?</description>
      <pubDate>Wed, 02 Nov 2016 19:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308854#M66342</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-02T19:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308855#M66343</link>
      <description>&lt;P&gt;Monname requires a date variable and I believe it's a format, not a function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do do you have multiple years?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is January 2016= Jan 2015 = January?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select date_variable format=monname.,&lt;/P&gt;
&lt;P&gt;put(date_variable, monname.) as new month&lt;/P&gt;
&lt;P&gt;from ....&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 19:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308855#M66343</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-02T19:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308857#M66344</link>
      <description>&lt;P&gt;The values need to be a SAS date value, which is numeric, in order to use the MONTH function.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 19:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308857#M66344</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-11-02T19:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308858#M66345</link>
      <description>ok, so I will make it numeric, and as Reeza stated it is not a function, so I think with changing the value to numeric and using the format that should work. Reeza, there are multiple months, I am not using the year.</description>
      <pubDate>Wed, 02 Nov 2016 19:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308858#M66345</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-02T19:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308859#M66346</link>
      <description>Thank you as well GreggB, I will make these changes and see if that solves my problem.</description>
      <pubDate>Wed, 02 Nov 2016 19:35:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308859#M66346</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-02T19:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308860#M66347</link>
      <description>&lt;P&gt;MONNAME is unknown function in SAS;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are several methods to get month name:&lt;/P&gt;
&lt;P&gt;1) create a &lt;STRONG&gt;format&lt;/STRONG&gt; like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;proc format lib=work;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value monname&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 = "January"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 = "February"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12 = "December"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; then, in your datastep use: month_name = put(month(date), monname.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Alternatively use &lt;STRONG&gt;select&lt;/STRONG&gt; statemnet to creat the month_name variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;data want&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mon = month(date);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;select (mon);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when (1) month_name = 'January';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when(2) month_name = 'February';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;when (12) month_name = 'December';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;otherwise month_name = 'Invalid Date';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 19:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308860#M66347</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-11-02T19:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308880#M66352</link>
      <description>&lt;P&gt;You don't need to convert anything, if your variable is a SAS date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
	date_var='01Nov2016'd;
	format date_var date9.;
	month_name=put(date_var, monname.);
run;

proc print ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2016 21:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/308880#M66352</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-02T21:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: MONNAME(MONTH(tbl.field_name))</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/441955#M110547</link>
      <description>&lt;P&gt;Your post helped and it could be made even simpler:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; create table&amp;nbsp;&amp;nbsp; mytablename&amp;nbsp; as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; choose_your_variables,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put(date_variable,monname.)&amp;nbsp; as&amp;nbsp; MonthNameColumn&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp; libref.table&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 22:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-month-as-name-from-a-date/m-p/441955#M110547</guid>
      <dc:creator>JTab</dc:creator>
      <dc:date>2018-03-02T22:53:55Z</dc:date>
    </item>
  </channel>
</rss>

