<?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: Only showing Month from date9 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822994#M324971</link>
    <description>&lt;P&gt;I am needing to make it a new column for a visual I am making. I need to keep the date9 because I delete information if it is before or after a certain date&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2022 19:41:13 GMT</pubDate>
    <dc:creator>ccaudillo100</dc:creator>
    <dc:date>2022-07-12T19:41:13Z</dc:date>
    <item>
      <title>Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822986#M324967</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In my table I have the date in date9. I am wanting to make a new column with just the month. Any examples on how to quickly do this?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822986#M324967</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-12T19:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822989#M324968</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423715"&gt;@ccaudillo100&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;would the MONTH function a possibility for you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/casfedsql/n19p26cyqlce6vn1lldtqfcuxbys.htm" target="_blank"&gt;SAS Help Center: MONTH Function&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822989#M324968</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-07-12T19:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822990#M324969</link>
      <description>&lt;P&gt;No need to make a new column. Just change the format. Use format MONNAME.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822990#M324969</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-12T19:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822992#M324970</link>
      <description>&lt;P&gt;Month number? Month name?&lt;/P&gt;
&lt;P&gt;Just the value or format the variable to look like just the month?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
mydate=today();
month_num = month(mydate);
month_name = put(mydate, monname3.);
month_num_fmt=mydate;
month_nam_fmt=mydate;
format mydate date9. month_num_fmt month. month_nam_fmt monname3.;
run;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423715"&gt;@ccaudillo100&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;In my table I have the date in date9. I am wanting to make a new column with just the month. Any examples on how to quickly do this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822992#M324970</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-12T19:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822994#M324971</link>
      <description>&lt;P&gt;I am needing to make it a new column for a visual I am making. I need to keep the date9 because I delete information if it is before or after a certain date&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822994#M324971</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-12T19:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822997#M324972</link>
      <description>&lt;P&gt;Do you need a new variable or are you just looking to print or group by the month in some report (or analysis)?&lt;/P&gt;
&lt;P&gt;If the later then just use a different format with the existing variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have;
  class date ;
  format date yymm7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the former than you could just map the date to the first of the month.&amp;nbsp; That way the value is still a date, but all of the observations from the same month will have the same value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;month = intnx('month',date,0,'b');
format&amp;nbsp;month&amp;nbsp;yymm7.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Should it include the year and the month? Or just the month?&amp;nbsp; Do you want the name of the month? Or the number?&lt;/P&gt;
&lt;P&gt;Do you want a string?&amp;nbsp; You could use the PUT() function with the appropriate format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;month_string=put(date,yymm7.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="tinyMceEditorTom_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822997#M324972</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-12T19:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822998#M324973</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423715"&gt;@ccaudillo100&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am needing to make it a new column for a visual I am making. I need to keep the date9 because I delete information if it is before or after a certain date&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can use the variable with the MONNAME format in your visual. You can still delete the information if it is before or after a certain date, even after you change the format. Changing the format does not change the underlying (unformatted) value, and SAS always uses the underlying (unformatted) value to do logical operatoins. So if you use the MONNAME format, you can still do things like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;where date &amp;lt; '01JAN2019'd&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and it will work just fine (because SAS uses the unformatted value always 100% of the time).&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:48:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/822998#M324973</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-12T19:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Only showing Month from date9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/823003#M324975</link>
      <description>&lt;P&gt;Technically not required, you can use the date in different formats in different places.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sashelp.stocks;
where stock='IBM' and date &amp;gt;= '06Jun1994'd;
series x=date y=open;
series x=date y=close;
format date monname3.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423715"&gt;@ccaudillo100&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am needing to make it a new column for a visual I am making. I need to keep the date9 because I delete information if it is before or after a certain date&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 20:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-showing-Month-from-date9/m-p/823003#M324975</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-12T20:12:14Z</dc:date>
    </item>
  </channel>
</rss>

