I don't have the bandwidth to work on this right now, but here's code to create the HAVE dataset for testing:
data have;
infile datalines dsd truncover;
input ID:32. trgt_dt:32. A1600:32. A1700:32. A1800:32. R4:32. A2100:32.;
format trgt_dt A1600 R4 DATE11.;
datalines4;
1,14770,,,,,
1,14775,14763,1,3,,
1,14783,,,,14783,1
1,16022,,,,,
1,16028,16015,1,3,,
1,16031,,,,16031,1
1,17189,17182,1,3,,
1,17195,,,,,
1,17197,,,,17197,1
1,17198,,,,,
1,17208,17197,1,3,17208,3
1,17209,17209,2,3,,
1,17216,17203,1,3,,
1,17219,,,,,
1,17230,,,,,
1,17251,,,,17251,1
;;;;
... View more