I want to do what seems to be something simple. Variable v2 should make an enumeration change when v1 changes. v1 need to come out in the unsorted way it is. How do I do this?
data new;
set old;
retain last_v1;
if last_v1 ne v1 then v2 +1;
last_v1 = v1;
run;
On the first row last_v1 will not be assigned so v2 is set to 1.
On row 4, where there is a change v1 will not equal last_v1 so 1 is added to v2.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Registration is open
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss. Register now and lock in 2025 pricing—just $495!