SAS计划增加薪水

时间:2017-01-18 11:48:55

标签: sas

我想在前两次观察表后总结薪水。 前两次观察将保持不变,应如下所示添加休息

Name    salary  Name    salary
subrat  10      subrat  10
abhi    20      abhi    20
milan   100     other   1000
sam     200         
sudhir  300         
muna    400         

1 个答案:

答案 0 :(得分:0)

data want;
 set have end = eof;
 if      _N_ in (1 2 3) then new_salary = salary;
 else if _N_ > 3        then new_salary + salary;

 if eof then name = "Other";

 if _N_ in (1 2) or eof;

drop salary;
rename new_salary = salary;
run;