<?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 Macro parameter of previous month with numeric sas date value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693106#M211293</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to ask a question regarding creating a sas macro parameter.&lt;/P&gt;
&lt;P&gt;User define current month (Let's say Sep 2020) with YYMM format.&lt;/P&gt;
&lt;P&gt;There are 2 tasks:&lt;/P&gt;
&lt;P&gt;1-Create macro parameter of start of previews month&lt;SPAN style="font-family: inherit;"&gt;(number that represent sas date).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;2-Create macro parameter of previews month in YYMM structure (Result:1908)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I have a problem to perform the 2nd&amp;nbsp; task&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mer&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 11:31:08 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2020-10-21T11:31:08Z</dc:date>
    <item>
      <title>Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693106#M211293</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to ask a question regarding creating a sas macro parameter.&lt;/P&gt;
&lt;P&gt;User define current month (Let's say Sep 2020) with YYMM format.&lt;/P&gt;
&lt;P&gt;There are 2 tasks:&lt;/P&gt;
&lt;P&gt;1-Create macro parameter of start of previews month&lt;SPAN style="font-family: inherit;"&gt;(number that represent sas date).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;2-Create macro parameter of previews month in YYMM structure (Result:1908)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I have a problem to perform the 2nd&amp;nbsp; task&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mer&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 11:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693106#M211293</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-10-21T11:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693107#M211294</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%let Cur_Mon_YYMM=1909;/*YYMM structure*/

%let Cur_Mon_date=%sysfunc(inputn(&amp;amp;Cur_Mon_YYMM.,yymmn4.));
/*SAS date:number of days since 1.1.1960*/

%put &amp;amp;Cur_Mon_date;

%let Prev_mon=%sysfunc(intnx(month,&amp;amp;Cur_Mon_date.,-1));
/*SAS date:number of days since 1.1.1960*/
%put &amp;amp;Prev_mon;

%let Prev_mon_YYMM=?????&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 11:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693107#M211294</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-10-21T11:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693109#M211296</link>
      <description>&lt;P&gt;For the 2nd:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let in=2009;
%let begin_last_month=%sysfunc(intnx(month,%sysfunc(inputn(20&amp;amp;in.01,yymmdd8.)),-1,b));

data _null_;
x=&amp;amp;begin_last_month;
put x yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 11:37:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693109#M211296</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-21T11:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693126#M211304</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;The desired outcome is 1908 ( by YYMM structrure).&lt;/P&gt;
&lt;P&gt;In the code that you sent I get sas date value and not 1908&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 12:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693126#M211304</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-10-21T12:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693128#M211306</link>
      <description>&lt;P&gt;Then you can assign it the proper format.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 12:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693128#M211306</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-21T12:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693154#M211320</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;The desired outcome is 1908 ( by YYMM structrure).&lt;/P&gt;
&lt;P&gt;In the code that you sent I get sas date value and not 1908&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Dead simple:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let begin_last_month=%sysfunc(intnx(month,%sysfunc(inputn(20&amp;amp;in.01,yymmdd8.)),-1,b),yymmn4.);

%put &amp;amp;begin_last_month.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 13:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693154#M211320</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-21T13:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693164#M211323</link>
      <description>&lt;P&gt;PS your subject line asked specifically for a SAS date value.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 13:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693164#M211323</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-21T13:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro parameter of previous month with numeric sas date value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693430#M211430</link>
      <description>&lt;P&gt;Thank you All,&lt;/P&gt;
&lt;P&gt;I wrote a summary based on the posts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Cur_YYMM=1909;
%let lastMon_YYMM=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;Cur_YYMM,yymmn4.)),-1),yymmn4.);
%put &amp;amp;lastMon_YYMM.;&lt;BR /&gt;/*1908*/&lt;BR /&gt;
%let StartOflastMon_date=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;Cur_YYMM,yymmn4.)),-1,b));
%put &amp;amp;StartOflastMon_date.;&lt;BR /&gt;/*21762 that represent #days from 1.1.1960 til 01Aug2020*/&lt;BR /&gt;
%let EndOflastMon_date=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;Cur_YYMM,yymmn4.)),-1,E));
%put &amp;amp;EndOflastMon_date.;&lt;BR /&gt;/*21792 that represent #days from 1.1.1960 til 31Aug2020*/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Oct 2020 08:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-parameter-of-previous-month-with-numeric-sas-date-value/m-p/693430#M211430</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-10-22T08:32:27Z</dc:date>
    </item>
  </channel>
</rss>

