这是我的输入:
data a;
policy_no = 1;
X_NET_PREMIUM_AMT = 1;
X_NET_PREMIUM_V_AMT = 8;
output;
policy_no = 1;
X_NET_PREMIUM_AMT = 2;
X_NET_PREMIUM_V_AMT = 6;
output;
policy_no = 1;
X_NET_PREMIUM_AMT = 9;
X_NET_PREMIUM_V_AMT = 4;
output;
policy_no = 1;
X_NET_PREMIUM_AMT = 12;
X_NET_PREMIUM_V_AMT = 5;
output;
policy_no = 1;
X_NET_PREMIUM_AMT = 6;
X_NET_PREMIUM_V_AMT = 3;
output;
policy_no = 2;
X_NET_PREMIUM_AMT = 18;
X_NET_PREMIUM_V_AMT = 78;
output;
policy_no = 2;
X_NET_PREMIUM_AMT = 25;
X_NET_PREMIUM_V_AMT = 16;
output;
policy_no = 2;
X_NET_PREMIUM_AMT = 91;
X_NET_PREMIUM_V_AMT = 42;
output;
policy_no = 3;
X_NET_PREMIUM_AMT = 123;
X_NET_PREMIUM_V_AMT = 52;
output;
policy_no = 3;
X_NET_PREMIUM_AMT = 4;
X_NET_PREMIUM_V_AMT = 1;
output;
run;
我需要做的是为每个policy_no:
X_NET_PREMIUM_AMT = X_NET_PREMIUM_AMT OF PREVIOUS ROW + X_NET_PREMIUM_V_AMT OF CURRENT ROW.
到目前为止 - 没有问题。
让我难以做到的是,我需要更新 X_NET_PREMIUM_AMT 以进行下一次计算,我将解释:
第 1 行(policy_no = 1):
X_NET_PREMIUM_AMT = 0(no previouse row) + 8 = 8;
第 2 行(policy_no = 1):
X_NET_PREMIUM_AMT = 8 + 6 = 14;
第 3 行(policy_no = 1):
X_NET_PREMIUM_AMT = 14 + 4 = 18;
等等....
不幸的是,我不知道该怎么做......
会感谢你的帮助