I have a data set with a name variable and a numeric value call it x, I want to create a new variable that will give a string to tell me if the previous 5 data steps that match that name had x > some number. For example:
Name x
Bill 108
Steve 77
Bill 99
Bill 150
Bill 121
Bill 56
Susan 108
Bill 95
I want the last Bill line to have a new variable that would be 'zyzzz' were the z indicates x > 100, y < 100, and then the next bill entry would have 'yzzzy' etc.
Any suggestions? Thanks.
Name x
Bill 108
Steve 77
Bill 99
Bill 150
Bill 121
Bill 56
Susan 108
Bill 95
I want the last Bill line to have a new variable that would be 'zyzzz' were the z indicates x > 100, y < 100, and then the next bill entry would have 'yzzzy' etc.
Any suggestions? Thanks.