Hi @JeffM1968,
I think you can simply correct your existing code:
Either use
if '% Units'n >=.98 then do;
if _tmp=.m then _tmp=ASP_New;
ASP_New=_tmp;
end;
retain _tmp .m;
drop _tmp;
if you want to carry forward the ASP_New value of the first observation with '% Units'n >=.98
or use
lag_ASP_New=lag(ASP_New);
if '% Units'n >=.98 then do;
if _tmp=.m then _tmp=lag_ASP_New;
ASP_New=_tmp;
end;
retain _tmp .m;
drop _tmp lag_ASP_New;
if you want to carry forward the ASP_New value of the observation before the first observation with '% Units'n >=.98.
... View more