Itβs convenient to have a couple of simple conversion macros like mine. See also my sas-l posts .
%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;
source share