@OLUGBOJI wrote:
Please see below for values of what I have vs what I want. I want to get repeated consecutive names for certain id's and their count and the cummulative count. Proccsql and sql if possible. Thanks
The moment you want to look for consecutive values in a data set, you should not be considering PROC SQL. It's simply not meant to care about record order. Yes, you can torture proc sql to do so, but it's just not worth it. So @jimbarbour 's suggestion of the BY ... NOTSORTED; statement is the way to go. It is exactly the right technique to detect and process repeated values.
I would suggest a simpler data step, however:
data want;
set have ;
by name notsorted;
repeat+1;
if first.name then repeat=1;
if last.name;
run;
... View more