比如,在id=1的样本中,只要出现了a=1,那么b在任何年份都为1,只有变量a在所有年份都为0,那么b才取值为0。我想生成满足这样条件的变量b,该什么实现呢?<br>
----------------------- copy starting from the next line -----------------------
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id year a b)
1 2000 0 1
1 2001 1 1
1 2002 0 1
1 2004 1 1
2 2001 0 0
2 2002 0 0
3 2003 1 1
4 2000 1 1
4 2001 1 1
4 2003 0 1
end
复制代码<br>
------------------ copy up to and including the previous line ------------------