<?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 Current Month and Year in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582550#M13860</link>
    <description>&lt;P&gt;Suppose I have a dataset like this. The date is in character format. I need to convert it into date format and choose only current month data from the below dataset. It should be dynamic. Also I need another dataset where I need previous month data only. This also needs dynamic. I could have chosen month(transmonth)= current month but I need year also. Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one ;&lt;BR /&gt;input obs id jobcat $ transmonth $11. ;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1254 one 29AUG2019&lt;BR /&gt;2 9936 two 19AUG2019&lt;BR /&gt;3 7529 two 01AUG2019&lt;BR /&gt;4 9154 one 03AUG2019&lt;BR /&gt;5 7741 two 18JUL2019&lt;BR /&gt;6 8896 two 11JUL2019&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2019 19:09:24 GMT</pubDate>
    <dc:creator>sameer112217</dc:creator>
    <dc:date>2019-08-20T19:09:24Z</dc:date>
    <item>
      <title>Current Month and Year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582550#M13860</link>
      <description>&lt;P&gt;Suppose I have a dataset like this. The date is in character format. I need to convert it into date format and choose only current month data from the below dataset. It should be dynamic. Also I need another dataset where I need previous month data only. This also needs dynamic. I could have chosen month(transmonth)= current month but I need year also. Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one ;&lt;BR /&gt;input obs id jobcat $ transmonth $11. ;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1254 one 29AUG2019&lt;BR /&gt;2 9936 two 19AUG2019&lt;BR /&gt;3 7529 two 01AUG2019&lt;BR /&gt;4 9154 one 03AUG2019&lt;BR /&gt;5 7741 two 18JUL2019&lt;BR /&gt;6 8896 two 11JUL2019&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 19:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582550#M13860</guid>
      <dc:creator>sameer112217</dc:creator>
      <dc:date>2019-08-20T19:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Current Month and Year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582553#M13861</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one ;
infile datalines truncover;
input obs id jobcat :$ transmonth :$11. wage :$10. rating;
datalines;
1 1254 one 29AUG2019 $11000.00 2
2 9936 two 19AUG2019 $5,000.00 0
3 7529 two 01AUG2019 $9,000.00 1
4 9154 one 03AUG2019 $10000.00 2
5 7741 two 18JUL2019 $9,500.00 3
6 8896 two 11JUL2019 $9,600.00 4
;
run;

data want;
set one;
numeric_date=input(transmonth,date9.);
if put(today(),monyy7.)=put(numeric_date,monyy7.);
format numeric_date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Aug 2019 19:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582553#M13861</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-20T19:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Current Month and Year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582555#M13862</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/89720"&gt;@sameer112217&lt;/a&gt;&amp;nbsp; This completes your question&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data current_monthyear prevmonth_curr_year;
set one;
numeric_date=input(transmonth,date9.);
if put(today(),monyy7.)=put(numeric_date,monyy7.) then output current_monthyear;
else if put(intnx('mon',today(),-1),monyy7.)=put(numeric_date,monyy7.) then output prevmonth_curr_year;
format numeric_date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Aug 2019 19:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/582555#M13862</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-20T19:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Current Month and Year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/585323#M14311</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 18:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Current-Month-and-Year/m-p/585323#M14311</guid>
      <dc:creator>sameer112217</dc:creator>
      <dc:date>2019-08-30T18:30:26Z</dc:date>
    </item>
  </channel>
</rss>

