Hello,
I am using the lag function which works for parts of my data set, while it doesn't in other parts (?) I am using this very simple data step below: Does anybody know what's wrong with this code?
Thank you!
data adjustment3; set adjustment3; if count_cluster=lag1(count_cluster) then Max_Salary_previous_grade=lag1(max_salary); else Max_Salary_previous_grade=0;
run;
TABLE GET
count_cluster
Max_salary
Max_Salary_previous_grade
1
56,768
-
1
70,741
56,768
ok!
2
49,957
-
3
50,000
-
4
34,360
-
4
49,790
70,741
Error!
4
53,220
49,790
ok!
TABLE WANT
count_cluster
Max_salary
Max_Salary_previous_grade
1
56,768
-
1
70,741
56,768
2
49,957
-
3
50,000
-
4
34,360
-
4
49,790
34,360
4
53,220
49,790
... View more