在用stata做面板数据的动态模型时,有用到滞后的被解释变量cplag1=cp[_n-1](cp是我定义的被解释变量名)
但是直接使用gen cplag1=cp[_n-1]会出现如下结果,只有缺失1项,显然结果是不对的.这里要求每个相同的id下1996年的
cplag1值都是缺失的.请教各位大虾该如何加限制条件?
id year cp ip cplag1
1 1996 3282.466 4106.251
1 1997 3646.15 4540.247 3282.466
1 1998 3777.41 4770.47 3646.15
1 1999 3989.581 5178.528 3777.41
1 2000 4203.555 5256.753 3989.581
1 2001 4495.174 5640.597 4203.555
1 2002 4784.364 6093.333 4495.174
2 1996 5133.978 6569.901 4784.364
2 1997 6203.048 7419.905 5133.978
2 1998 6807.451 8273.418 6203.048
2 1999 7453.757 9127.992 6807.451
2 2000 8206.271 9999.7 7453.757
2 2001 8654.433 11229.66 8206.271
2 2002 10473.12 12692.38 8654.433
3 1996 4011.775 4884.731 10473.12
3 1997 4853.441 6040.944 4011.775
3 1998 5197.041 6505.145 4853.441
3 1999 5314.521 6922.109 5197.041
3 2000 5522.762 7279.393 5314.521
3 2001 6094.336 8422.573 5522.762
3 2002 6665.005 9235.538 6094.336
4 1996 3197.339 4148.282 6665.005
4 1997 3868.319 4790.986 3197.339
4 1998 3896.778 5167.317 3868.319
4 1999 4104.281 5468.94 3896.778
4 2000 4361.555 5678.195 4104.281
4 2001 4457.463 5955.045 4361.555
4 2002 5120.485 6747.152 4457.463
[此贴子已经被作者于2006-4-27 13:56:38编辑过]