@ballardw I have read the retain function but I am not quite sure I understand what is going on behind the scenes and was hoping you could assist me. The code below is doing exactly what I need it to do but I am not sure what is going on behind the scenes at lines 5 & 6 below. The code below returns the status right before an inactive status (which are documented as 4099, 4999) for each ID. 1) data want; 2) set have; 3) by ID STATUS_DATE STATUS_CD; 4) retain STATUS_CD; 5) if last.ID then call missing(STATUS_CD); 6) if STATUS_CD not in (4099,4999) then STAT_LAG=lag(STATUS_CD); 7) run;
... View more