Hi everyone,
I am dealing with a hectic problem as described below. I have a person-year data format on couples’ info (i.e., husbands and wives). For case #15 in the below data example (ID=HHID+PN), I would like to replace "C=0" with “C=2" in year=2004 if the case’s wife (HHID+rPN_SP) reported that B=1 in the same year (case #11).
Thanks,
Nader

* Example generated by -dataex-. To install: ssc install dataex
Code:
clear
input str6 HHID str3(PN rPN_SP) float year byte wave float(B C)
"000003" "010" "020" 2004  7 0 0
"000003" "010" "020" 2006  8 0 0
"000003" "010" "020" 2008  9 0 0
"000003" "010" "020" 2010 10 0 0
"000003" "010" "020" 2012 11 0 0
"000003" "020" "010" 2004  7 0 0
"000003" "020" "010" 2006  8 0 0
"000003" "020" "010" 2008  9 0 0
"000003" "020" "010" 2010 10 0 0
"000003" "020" "010" 2012 11 0 0
"010004" "010" "040" 2004  7 1 0
"010004" "010" "040" 2006  8 0 0
"010004" "010" "040" 2008  9 0 0
"010004" "010" "040" 2010 10 0 0
"010004" "040" "010" 2004  7 0 0
"010004" "040" "010" 2006  8 0 0
"010004" "040" "010" 2008  9 0 0
"010004" "040" "010" 2010 10 0 0
end