Hello,
in this dataset "have". i would like to get a flag populated only when i_jour_sem = i_sem.
the first time that this criteria is met then the flag shoul be 1, the second time then 2, the 3è then 3, but the 4 times the 1, the 5 times then 2 ...
so , only whenever i_jour_sem = i_sem.the flag should be 1,2,3,1,2,3...
thanks for your help in advance
Data have ;
infile datalines ;
input name $ week i_jour_sem i_sem ;
datalines ;
Andrew 39 1 1
Andrew 39 2 1
Andrew 39 3 1
Andrew 39 4 1
Andrew 39 5 1
Andrew 40 1 2
Andrew 40 2 2
Andrew 40 3 2
Andrew 40 4 2
Andrew 40 5 2
Andrew 41 1 3
Andrew 41 2 3
Andrew 41 3 3
Andrew 41 4 3
Andrew 41 5 3
Andrew 42 1 4
Andrew 42 2 4
Andrew 42 3 4
Andrew 42 4 4
Andrew 42 5 4
Andrew 43 1 5
Andrew 43 2 5
Andrew 43 3 5
Andrew 43 4 5
Andrew 43 5 5
Andrew 44 1 6
Andrew 44 2 6
Andrew 44 3 6
Andrew 44 4 6
Andrew 44 5 6
;
run ;
... View more