2017年1月29日星期日

Simple SAS codes to understand set loop and order duplicated cases.

data try;
input pid value;
datalines;
1 1
1 3
1 5
2 1
2 2
3 1
3 2
3 6
3 8
;
run;
data try2;
set try;
by pid;
episode+1;
if first.pid then episode=1;
run;