<?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: Sas current year-month,  previous year-month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434405#M107789</link>
    <description>Hi Reeza,&lt;BR /&gt;&lt;BR /&gt;No I didnt.&lt;BR /&gt;&lt;BR /&gt;Could you please help me with the intx function over this issue?</description>
    <pubDate>Mon, 05 Feb 2018 22:15:41 GMT</pubDate>
    <dc:creator>sayanapex06</dc:creator>
    <dc:date>2018-02-05T22:15:41Z</dc:date>
    <item>
      <title>Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434401#M107787</link>
      <description>Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I need to find the syntax for sas (year-month)&lt;BR /&gt;&lt;BR /&gt;Suppose I code :&lt;BR /&gt;&lt;BR /&gt;Curr = put(today, mmyyd.) ;&lt;BR /&gt;I will be getting&lt;BR /&gt;Curr = 02-2018&lt;BR /&gt;&lt;BR /&gt;Now my question is,&lt;BR /&gt;&lt;BR /&gt;I need from the sas date function&lt;BR /&gt;Curr01 = 12-2017&lt;BR /&gt;Curr02 = 11-2017&lt;BR /&gt;&lt;BR /&gt;Curr01 being the previous month and year&lt;BR /&gt;Curr02 beung the previous of the previous month&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Could you please help me with this function, so that even if I am in the middle of the year, I can get a month - 1 and month - 2 with a single code?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Sayan</description>
      <pubDate>Mon, 05 Feb 2018 22:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434401#M107787</guid>
      <dc:creator>sayanapex06</dc:creator>
      <dc:date>2018-02-05T22:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434402#M107788</link>
      <description>&lt;P&gt;Did you try INTNX()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120272"&gt;@sayanapex06&lt;/a&gt; wrote:&lt;BR /&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I need to find the syntax for sas (year-month)&lt;BR /&gt;&lt;BR /&gt;Suppose I code :&lt;BR /&gt;&lt;BR /&gt;Curr = put(today, mmyyd.) ;&lt;BR /&gt;I will be getting&lt;BR /&gt;Curr = 02-2018&lt;BR /&gt;&lt;BR /&gt;Now my question is,&lt;BR /&gt;&lt;BR /&gt;I need from the sas date function&lt;BR /&gt;Curr01 = 12-2017&lt;BR /&gt;Curr02 = 11-2017&lt;BR /&gt;&lt;BR /&gt;Curr01 being the previous month and year&lt;BR /&gt;Curr02 beung the previous of the previous month&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Could you please help me with this function, so that even if I am in the middle of the year, I can get a month - 1 and month - 2 with a single code?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Sayan&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 22:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434402#M107788</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-05T22:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434405#M107789</link>
      <description>Hi Reeza,&lt;BR /&gt;&lt;BR /&gt;No I didnt.&lt;BR /&gt;&lt;BR /&gt;Could you please help me with the intx function over this issue?</description>
      <pubDate>Mon, 05 Feb 2018 22:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434405#M107789</guid>
      <dc:creator>sayanapex06</dc:creator>
      <dc:date>2018-02-05T22:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434407#M107790</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120272"&gt;@sayanapex06&lt;/a&gt;&amp;nbsp;a simple google search will give you tons of syntax, examples, scenarios. Why be so dependent to ask for syntax help and so on. Personally, I think it is not fair. Anyway, up to you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/INTNX_Function_examples" target="_blank"&gt;http://www.sascommunity.org/wiki/INTNX_Function_examples&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 22:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434407#M107790</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2018-02-05T22:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434410#M107791</link>
      <description>So the current date is 05FEB2018&lt;BR /&gt;&lt;BR /&gt;what will happen if I use this&lt;BR /&gt;&lt;BR /&gt;Curr02 = intx('month', currd, -2)&lt;BR /&gt;&lt;BR /&gt;What will be the value of curr02?</description>
      <pubDate>Mon, 05 Feb 2018 22:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434410#M107791</guid>
      <dc:creator>sayanapex06</dc:creator>
      <dc:date>2018-02-05T22:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434411#M107792</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120272"&gt;@sayanapex06&lt;/a&gt; wrote:&lt;BR /&gt;So the current date is 05FEB2018&lt;BR /&gt;&lt;BR /&gt;what will happen if I use this&lt;BR /&gt;&lt;BR /&gt;Curr02 = intx('month', currd, -2)&lt;BR /&gt;&lt;BR /&gt;What will be the value of curr02?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Run it and see....&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 22:37:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434411#M107792</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-05T22:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434419#M107795</link>
      <description>Don't forget the optional 4th INTNX() parmeter:&lt;BR /&gt;"B" - beggining of period&lt;BR /&gt;"M" - middle of period&lt;BR /&gt;"E" - end of period&lt;BR /&gt;"S" - same place in period</description>
      <pubDate>Mon, 05 Feb 2018 23:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434419#M107795</guid>
      <dc:creator>AndrewHowell</dc:creator>
      <dc:date>2018-02-05T23:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434554#M107843</link>
      <description>&lt;P&gt;I coded the following :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TEST ;&lt;BR /&gt;&lt;BR /&gt;C_MONTH = MONTH(TODAY()) ;&lt;BR /&gt;C_YEAR = YEAR(TODAY()) ;&lt;BR /&gt;&lt;BR /&gt;P_MONTH =%SYSFUNC(MONTH(%SYSFUNC(INTNX(MONTH, %SYSFUNC(TODAY()), -1))));&lt;BR /&gt;&lt;BR /&gt;P_YEAR =%SYSFUNC(YEAR(%SYSFUNC(INTNX(MONTH, %SYSFUNC(TODAY()), -1))));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = TEST ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;got the output as :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C_MONTH C_YEAR P_MONTH P_YEAR&lt;BR /&gt;&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2018&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now what to do if I want a P_P_MONTH (previous of the previous month) and P_P_YEAR&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;P_P_MONTH&amp;nbsp; &amp;nbsp;has to be&amp;nbsp; 12&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;P_P_YEAR&amp;nbsp; &amp;nbsp; has to be 2017&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please help me with the above&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 14:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434554#M107843</guid>
      <dc:creator>sayanapex06</dc:creator>
      <dc:date>2018-02-06T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sas current year-month,  previous year-month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434596#M107857</link>
      <description>&lt;P&gt;1. You need SAS dates for using INTNX. Don’t separate it to year and Month components.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You don’t need SYSFUNC within a data step&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. For previous month and year, that’s 13 months ago. Try using Month and -13 in INTNX.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Please format and comment your code. Formatting makes it easier to read, commenting shows your logic or what you expect so we can help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. Use the format YYMMN6 to get the dates you want&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 17:03:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-current-year-month-previous-year-month/m-p/434596#M107857</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-06T17:03:32Z</dc:date>
    </item>
  </channel>
</rss>

