I have a SAS dataset similar to:
Joe
Joe
John
Bill
Bill
Bill
Bill
Joanne
Joanne
Fred
Fred
Fred
Ted
What I am trying to do is make it into a new dataset that has each entry only once, with an added variable that stores the "streak" of that variable. For example, the set would look like:
Joe 2
Bill 4
Joanne 2
Fred 3
Ted 1
So far I've created the first data set but am stuck on how to do the second. My idea is to create a variable in the data step that holds the value of the last observation for comparison, but I can't figure out how to do that, or then how I'd turn it into the second data set.
I'm not sure if returning to the previous observation is even possible in SAS, maybe this is a problem for a proc sql
, but then I need a new data set
not a table.