Hi, I have a dataset of records for bridges (attached), each bridge has its own structure number given as STRUCTURE_NUMBER_008, and the dataset is ordered based on STRUCTURE_NUMBER_008 and Inspection_year. The frequency each bridge is recorded is different as seen in the last column variable Freq. The variable SUPERSTRUCTURE_COND_059 can take rating number of 4, 5, 6, 7, and 8. I would like to trim the dataset for each bridge based on the following condition. If the first 5 rating or last five rating for each bridge for variable SUPERSTRUCTURE_COND_059 is identical (e.g., 4 4 4 4 4 or 6 6 6 6 6, ...) I want to retain all the observations with the middle observations. But if the first five rating for each bridge for variable SUPERSTRUCTURE_COND_059 is different (e.g., 4 4 4 4 5 or 7 7 6 6 6 or 8 7 7 7 7) I would like to delete the observations encountered first. For the example above I want to delete 4 4 4 4 or 7 7 or 8 and retain the remaining observation with the middle observations for the bridge. if the the last five observations for a bridge is (e.g., 4 4 4 4 5 or 7 7 6 6 6 or 8 7 7 7 7), I want to delete observations that is changed, which in this case I would delete 5, 6 6 6, or 7 7 7 7. I would be grateful I anyone could help me on this. The data set is attached. Thanks,
... View more