@DSAS_er wrote:
Oh, as in there are no subsequent values following that date, so the last date of data for variable1 is January 17 and for variable2 January 19, nothing more since.
Finally something that almost resembles are rule.
So you use the OUTPUT from Proc expand:
Data want;
set after;
if date > '17JAN2021'd then call missing(Variable1_avg);
if date > '19JAN2021'd then call missing(Variable2_avg);
run;
If you expect to do something like this "automagically" you would need to process the input data set for proc expand, find the last valid row and find a way to provide those dates to the data step. This could involve macro language, summarizing the data to get data and merge it with the "after" data or possibly hash objects. There are several ways depending on complexity of data.
If the data is ugly enough and not too long it may be easiest to just look at the results in the AFTER and write a data step like I did.
... View more