Wonder if you find these two macros of mine handy: %*-- two utilities --*; %macro date2num(date, informat=anydtdte.); %*-- strip quotations and postfix d from date literal if any. --*; %*-- quotations are intentionally doubled to prevent unmatched error --*; %let date=%sysfunc(prxchange(s/[''""]d?//i,-1,&date)); %sysfunc(inputn(&date,&informat)) %mend date2num; %macro num2date(num, format=date10., literal=1); %local n; %let n = %sysfunc(putn(&num,&format)); %if &literal %then "&n"d; %else &n; %mend num2date; %*-- usage example --*; %let date1 = 30nov2012; %let barry = %sysfunc(putn("&date1"d-1, date9.)); %let chang = %num2date(%date2num(&date1) - 1, literal=0); %put barry=&barry chang=&chang; %*-- on log barry=29NOV2012 chang=29NOV2012 --*;
... View more