Try this. data dates; set olddates; if not missing (stdate) then stdate_n=input(stdate,B8601DT19.); if not missing (enddate) then enddate_n=input(enddate,B8601DT19.); run; ***********For min stdate; proc sort data=stdate_min; by id stdate_n; run; data stdate_min; set stdate_min; by id stdate_n; if first.id; run; **********In the same way we can find out max value of endate; proc sort data=enddate_min; by id enddate_n; run; data enddate_min; set enddate_min; by id enddate_n; if last.id; run; Please check not tried on the data.....
... View more