Tom, that is true and a good point. It's a personal preference for me. The way the code and log will be documented I like to see the applicable month for each libname. Here's the final code in case it helps anyone in the future. Do people search here first? data _null_; date9 = today()-15; /* add -15 after today() if testing before the 15th business day*/ call symput('num_month',strip(put(month(today())-2,z2.))); /*-1 should be changed to -2 if testing before the 15th business day*/ run; %macro cib; %do i= &num_month %to 01 %by -1; data _null_; date9 = today()-15; /* add -15 after today() if testing before the 15th business day*/ call symput('num_month',strip(put(month(today())-&i-1,z2.))); /*-1 should be changed to -2 if testing before the 15th business day*/ call symputx('year',strip(year(today())),'g'); call symputx('date9',put(date9,date9.),'g'); call symputx('gooddate9',put(intnx('month',date9,-&i,'e'),date9.),'g'); call symputx('date9_2',put(intnx('month',date9,-&i,'e'),date9.),'g'); call symputx('lastmon',substr(put(intnx('month',date9,-&i,'e'),date9.),3,3),'g'); call symputx('mon',put(intnx('month',date9,-&i,'e'),date9.),'g'); call symputx('_mon',put(intnx('month',date9,-&i-1,'e'),date9.),'g'); call symputx('_lastmon',substr(put(intnx('month',date9,-&i-1,'e'),date9.),3,3),'g'); call symputx('monyear',substr(put(intnx('month',date9,-&i,'e'),mmddyy10.),1,2)||substr(put(intnx('month',date9,-&i,'e'),date9.),6,4),'g'); call symputx('_monyear',substr(put(intnx('month',date9,-&i,'e'),mmddyy10.),1,2)||substr(put(intnx('month',date9,-&i,'e'),date9.),6,4),'g'); call symputx('mmddyy10',put(intnx('month',date9,-&i,'e'),mmddyy10.),'g'); call symputx('_mmddyy10',put(intnx('month',date9,-&i,'e'),mmddyy10.),'g'); run; data _null_; call symputx('propdate',cats(propcase(substr("&mon",3,3)),substr("&mon",6,4)),'g'); call symputx('_propdate',cats(propcase(substr("&_mon",3,3)),substr("&_mon",6,4)),'g'); run; data test_&monyear; test = "&lastmon"; run; ; %end; %mend; %cib;
... View more