I have a dataframe like:
householdno | foodcount | foodcode | ||
1 | 1 | 67 | ||
1 | 2 | 65 | ||
1 | 3 | 875 | ||
2 | 1 | 65 | ||
2 | 2 | 344 | ||
2 | 3 | 367 | ||
3 | 1 | 67 | ||
3 | 2 | 54 | ||
4 | 1 | 76 | ||
4 | 2 | 98 | ||
4 | 3 | 76 | ||
..... | ... | .... |
Code:
insobs 14 replace foodcode=67 if missing(foodcode) foreach i in 5 6 7 8 9 10 49 47 104 132 133 134 135 145 { replace householdno=`i' if missing(householdno) & householdno!=`i' }
Can you please tell me what goes wrong here?
Thank you so much in advance!
0 Response to How to insert multiple values in Stata
Post a Comment