It should work. this is how I tested: %let i=2009; %let v1 = %sysfunc(intnx(month,"01jan&i"d,0,sameday)); %let v2 = %sysfunc(intnx(month,&v1,0,sameday),date9.); %let v3 = %sysfunc(intnx(month,"09jan&i"d,0,sameday)); %let v4 = %sysfunc(intnx(month,&v3,0,sameday),date9.); %let v5=%sysfunc(max("&v2"d,"&v4"d)); %let v6=%sysfunc(min("&v2"d,"&v4"d)); %let v7=%sysfunc(putn(&v5,date9.)); %let v8=%sysfunc(putn(&v6,date9.)); %put &v1 &v2 &v3 &v4 &v5 &v6 &v7 &v8; From log file: 165 166 %let i=2009; 167 %let v1 = %sysfunc(intnx(month,"01jan&i"d,0,sameday)); 168 %let v2 = %sysfunc(intnx(month,&v1,0,sameday),date9.); 169 %let v3 = %sysfunc(intnx(month,"09jan&i"d,0,sameday)); 170 %let v4 = %sysfunc(intnx(month,&v3,0,sameday),date9.); 171 %let v5=%sysfunc(max("&v2"d,"&v4"d)); 172 %let v6=%sysfunc(min("&v2"d,"&v4"d)); 173 174 %let v7=%sysfunc(putn(&v5,date9.)); 175 %let v8=%sysfunc(putn(&v6,date9.)); 176 177 %put &v1 &v2 &v3 &v4 &v5 &v6 &v7 &v8; 17898 01JAN2009 17906 09JAN2009 17906 17898 09JAN2009 01JAN2009
... View more