07-11-2016 06:45 AM
So, variable b has same value 5 in rows 3 and 4. I need to flag first value (row 3)as 0 and subseqent rows containing value 5 as 1.
07-11-2016 07:12 AM
This is my 2 cents. Depending on what you'd like to do with variable a your final version can differ. But the use of first. will be my recommendation.
proc sort data=have; by id b; run; data want; set have; by id b; if first.b then c=0; else c=1; run;
Need further help from the community? Please ask a new question.