Hello every one, I use stata 10 for my work. I am working with unit level data where in one of the data file the household expenditure is given item wise (1:food, 2: health, 3: education, etc...7: sum of 2-6 and 8:sum of 1-6). Data is in long form. Now my interest is to validate the item 7 and 8 i.e. whether the sum is correct or not. I am trying to generate new variable for item 7 and 8 using command
With this command I am getting missing value in item 8 cell, whereas I want value there also so that I can easily validate the data. Below is the output
Please suggest me correction in my command.
Thanks
Prakash
Code:
bys hhid: egen item8=sum( exp) if sno_item>1 & sno_item<8
Code:
+-----------------------------------------+
| hhid sno_item exp item8 |
|-----------------------------------------|
1. | 41000011 1 2000 . |
2. | 41000011 2 3500 3680 |
3. | 41000011 6 130 3680 |
4. | 41000011 7 50 3680 |
5. | 41000011 8 3680 . |
|-----------------------------------------|
6. | 41000011 9 5680 . |
7. | 410000110 1 2600 . |
8. | 410000110 6 300 300 |
9. | 410000110 8 300 . |
10. | 410000110 9 2900 . |
+-----------------------------------------+
Thanks
Prakash

Comment