Hello, I am trying to make a new variable with the following command
Code:
gen gift_group_test = 0 if gift_total < . & gift_received == 1
replace gift_group_test = 0 if gift_total > 0 & gift_total < 10000
replace gift_group_test = 1 if gift_total >= 10000 & gift_total < 100000
replace gift_group_test = 2 if gift_total > 100000
label define gift_group_test 0 "<10K" 1 "10k-100K" 2 "100K+"
Basically I want to order gifts people have received into 3 groups, below 10k, up to 100k and over 100k. I want to exclude any observations where the person received 0. However, for some reason certain observations are included where the gift received = 0. I thought I would exclude this via the set up. Gift_received == 1 means that the person states they have received a gift. Any idea why I have certain where gifts are == 0? Even if the person says they received a gift and then states the amount is = 0, shouldn't I still be able to exclude that observation by saying gift_total needs to be larger than 0 and smaller than 10k if it wants to be in group 0?
0 Response to Observations in new variable that shouldn't be included
Post a Comment