Dear all,
I want to replace the mean of a health outcome in post-policy period with pre-policy period. However, it returns "(0 real changes made)". Any help would be highly appreciated.
Data
I want to replace the mean of a health outcome in post-policy period with pre-policy period. However, it returns "(0 real changes made)". Any help would be highly appreciated.
Code:
// compute mean of health for pre-policy bys country region urban: egen m_health = mean(health) if policy==1 // try replacing the missing values of m_health in post-policy with those of the pre-policy means bys country region urban: replace m_health = m_health if policy==0 // Result (0 real changes made)
Code:
clear input byte health str32 country byte(region urban policy) 0 "A" 1 1 1 1 "A" 2 0 1 0 "A" 3 0 1 1 "A" 4 0 1 1 "A" 5 1 1 1 "A" 6 0 0 0 "A" 7 1 0 0 "A" 2 0 0 0 "A" 4 1 0 0 "A" 6 1 0 1 "A" 3 0 0 0 "B" 1 0 1 1 "B" 2 1 1 1 "B" 3 1 1 0 "B" 4 0 1 1 "B" 5 0 1 1 "B" 5 0 0 1 "B" 6 0 0 1 "B" 4 0 0 0 "B" 2 0 0 0 "B" 4 0 0 0 "B" 3 0 0 0 "B" 6 0 0 0 "C" 2 1 1 0 "C" 3 0 1 0 "C" 4 0 1 1 "C" 5 0 1 1 "C" 6 0 1 0 "C" 7 1 0 1 "C" 1 0 0 0 "C" 2 1 0 1 "C" 6 0 0 0 "C" 1 1 0 1 "C" 5 0 0 0 "C" 1 1 0 1 "C" 3 0 0 end
Comment