Also, I beg your pardon as I forgot to add a very important note in terms of efficiency. It's always better to filter or subset using where processing before SQL processor reads every record i.e in other words ideally the SQL processor should only select records that satisfy a condition meaning pick only the subset and not process the entire set, and then filter based on a computed column.
Often the better way is
where datepart(datetm) ge today();
rather than
where calculated TERM_DT ge today();
Full illustration below:
/*Sample dataset HAVE */
data have;
do datetm=intnx('dtday',datetime(),-2) to intnx('dtday',datetime(),+2) by 86400;
output;
end;
format datetm datetime20.;
run;
/*Output dataset MEME */
proc sql;
create table MEME1 as
select datepart(datetm) as Term_DT format=date9.
from have
where datepart(datetm) ge today();
quit;
HTH & Regards!
... View more