<?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: automatically itirate from endmonth data to prior eleven months data without resetting dates in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/automatically-itirate-from-endmonth-data-to-prior-eleven-months/m-p/361679#M10875</link>
    <description>&lt;P&gt;Post the log with the code an results of&lt;/P&gt;
&lt;PRE&gt;data _null_;

call symput('MthKeyCurrent', "'" put(&amp;amp;EndMonth,yymmn6.));

call symput('MthKey1Prior', "'" put(intnx('month',&amp;amp;EndMonth,-1,'e'),yymmn6.));

call symput('MthKey2Prior', "'" put(intnx('month',&amp;amp;EndMonth,-2,'e'),yymmn6.));

 

call symput('PMADDate', "'"||put(&amp;amp;EndMonth,mmddyy10.)||"'");

call symput('DWDate', "'"||put(&amp;amp;EndMonth,yymmdd10.)||"'");

run;

%put &amp;amp;MthKeyCurrent &amp;amp;MthKey1Prior &amp;amp;MthKey2Prior &amp;amp;PMADDate &amp;amp;DWDate;

 

can someone help?
&lt;/PRE&gt;
&lt;P&gt;Also paste it into a codebox opened with the forum {i} menu icon to preserve formating of the error messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it will also help to provide the values you had for &amp;amp;endmonth.&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2017 16:33:56 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-05-25T16:33:56Z</dc:date>
    <item>
      <title>automatically itirate from endmonth data to prior eleven months data without resetting dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/automatically-itirate-from-endmonth-data-to-prior-eleven-months/m-p/361668#M10874</link>
      <description>&lt;P&gt;I have the following SAS macro to regenerate monthly credit exceptions balances. to avoid date errors,&amp;nbsp;I do not want to constantly change dates. I&amp;nbsp;need to automate the process with a macro. Here is my current process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;****** UPDATE MACRO DATES FOR LAST 12 MONTHS ****************;
%let Mth4 = 01;
%let Yr4 = 2017;

%macro dates(date, mth, yr);
    proc sql ;
        /* connect to oracle as db(user=&amp;amp;usr. password=&amp;amp;pass. path=f3rdprod buffsize=4000)*/;
        create table get_data as /*select * from connection to db*/(select acct_num, 
            acct_key, app_num, bank_num, dealr_loc, amt_orig_loan, amt_principal_bal, 
            dt_loan_entry from emrsstap.dr_plr_&amp;amp;date /*plr_accnt_dtl*/
            where proc_type='05' and acct_purge_ind='N' and collat_cd='AUT' and 
            mth_key=&amp;amp;date.);
    quit;

    data get_losses;
        set get_data;
        where collat_purp_cd ^='BUS' and (amt_coff_mtd ^=0 or amt_recover_mtd ^=0);
        amt_ncoff_mtd=amt_coff_mtd - amt_recover_mtd;
    run;

    data get_orig;
        set get_data;
        where collat_purp_cd ^='BUS' and datepart(dt_loan_entry) &amp;gt;=mdy(&amp;amp;mth, 01, &amp;amp;yr);
        accountnumber=acct_num * 1;
    run;

    proc summary data=get_data;
        where collat_purp_cd ^='BUS' and acct_stat ^='CL' and proc_stat ^='CF';
        class bank_num dealr_loc;
        var amt_principal_bal;
        output out=get_balances sum=;
    run;

    data get_balances;
        set get_balances;
        mth_bal=&amp;amp;date;
    run;

    proc append data=get_losses base=Losses force;
    run;

    proc append data=get_EPD base=EPD3 force;
    run;

    proc append data=get_orig base=Orig force;
    run;

    proc append data=get_balances base=running_Balances force;
        where _TYPE_=3;
    run;

    proc append data=get_early_payoff base=Early_Payoff force;
    run;

%mend;

%dates(201505, 05, 2015);
%dates(201506, 06, 2015);
%dates(201507, 07, 2015);
%dates(201508, 08, 2015);
%dates(201509, 09, 2015);
%dates(201510, 10, 2015);
%dates(201511, 11, 2015);
%dates(201512, 12, 2015);
%dates(201601, 01, 2016);
%dates(201602, 02, 2016);
%dates(201603, 03, 2016);
%dates(201604, 04, 2016);

data exceptions;
    set consind.exceptions_2016;
    where mdy(&amp;amp;mth12, 01, &amp;amp;yr12) &amp;lt;=pbookingdate &amp;lt; mdy(&amp;amp;mth12, 01, &amp;amp;yr);
    excep=1;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=====================I am working to automate with this process but keep &lt;BR /&gt; getting errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    call symput('MthKeyCurrent', "'" put(&amp;amp;EndMonth, yymmn6.));
    call symput('MthKey1Prior', "'" put(intnx('month', &amp;amp;EndMonth, -1, 'e'), 
        yymmn6.));
    call symput('MthKey2Prior', "'" put(intnx('month', &amp;amp;EndMonth, -2, 'e'), 
        yymmn6.));
    call symput('PMADDate', "'"||put(&amp;amp;EndMonth, mmddyy10.)||"'");
    call symput('DWDate', "'"||put(&amp;amp;EndMonth, yymmdd10.)||"'");
run;

%put &amp;amp;MthKeyCurrent &amp;amp;MthKey1Prior &amp;amp;MthKey2Prior &amp;amp;PMADDate &amp;amp;DWDate;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can someone help?&lt;/P&gt;
&lt;P&gt;St. Sypress&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 17:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/automatically-itirate-from-endmonth-data-to-prior-eleven-months/m-p/361668#M10874</guid>
      <dc:creator>so1gban</dc:creator>
      <dc:date>2017-05-25T17:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: automatically itirate from endmonth data to prior eleven months data without resetting dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/automatically-itirate-from-endmonth-data-to-prior-eleven-months/m-p/361679#M10875</link>
      <description>&lt;P&gt;Post the log with the code an results of&lt;/P&gt;
&lt;PRE&gt;data _null_;

call symput('MthKeyCurrent', "'" put(&amp;amp;EndMonth,yymmn6.));

call symput('MthKey1Prior', "'" put(intnx('month',&amp;amp;EndMonth,-1,'e'),yymmn6.));

call symput('MthKey2Prior', "'" put(intnx('month',&amp;amp;EndMonth,-2,'e'),yymmn6.));

 

call symput('PMADDate', "'"||put(&amp;amp;EndMonth,mmddyy10.)||"'");

call symput('DWDate', "'"||put(&amp;amp;EndMonth,yymmdd10.)||"'");

run;

%put &amp;amp;MthKeyCurrent &amp;amp;MthKey1Prior &amp;amp;MthKey2Prior &amp;amp;PMADDate &amp;amp;DWDate;

 

can someone help?
&lt;/PRE&gt;
&lt;P&gt;Also paste it into a codebox opened with the forum {i} menu icon to preserve formating of the error messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it will also help to provide the values you had for &amp;amp;endmonth.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 16:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/automatically-itirate-from-endmonth-data-to-prior-eleven-months/m-p/361679#M10875</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-25T16:33:56Z</dc:date>
    </item>
  </channel>
</rss>

