The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Community level variable (How to create community level variables from individual variable.)
Community level variable [message #20257] Fri, 16 October 2020 05:39 Go to next message
saifulhaq is currently offline  saifulhaq
Messages: 7
Registered: October 2019
Member
Hello,
Can any one tell how to create community level variable using individual level variable on STATA. Please share do.file because i am clueless on how to generate community level variables using STATA. Your help shall be a huge contribution.
Looking forward,


Saif
Pakistan.
Re: Community level variable [message #20262 is a reply to message #20257] Fri, 16 October 2020 10:19 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

There have been some earlier postings on this topic. For the most part you can do what you want with variations on the "egen" command. For example if you want to construct a variable that is the proportion of women in the cluster who have no secondary schooling, you could use these commands: "gen no_school=0; replace no_school=1 if v106==0; egen no_school_prop=rowmean(no_school, by(v001).

I suggest you enter "help egen" and then look at the commands for which "by" is allowed. To get a cluster-level variable you use "by(v001)".

The clusters are often treated as villages or neighborhoods or communities, but of course they are actually census enumeration areas and their boundaries may or may not be appropriate for this interpretation.
Re: Community level variable [message #20530 is a reply to message #20257] Sun, 15 November 2020 07:49 Go to previous messageGo to next message
Varsha is currently offline  Varsha
Messages: 25
Registered: November 2020
Member
Hello.
I want to calculate maternal autonomy at the community level. I have created 3 measures of individual maternal autonomy using the information on the extent to which a woman participates in the decision-making process regarding:
1. her own health,
2. visiting family members and friends, and
3. how to use money that the husband earns

I have assigned a value of 0 if the response was 'respondent alone' and 'husband and respondent', and -1 otherwise. How can I calculate the proportion of women per PSU scoring a value of 0?
Re: Community level variable [message #21554 is a reply to message #20530] Wed, 18 November 2020 14:27 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

You scored this variable to be either 0 or -1? Do you mean 1 and 0? Usually a binary variable is coded 1 for yes and 0 for no.

The mean of a binary variable x is the proportion of cases that are coded 1.

If you want to get that proportion (or the mean of x) within clusters the command is "egen X=mean(x), by(v001)". The PSU is given by v001 or v021.

Previous Topic: Guidance regarding Gender Pooling in Liberia 2013 DHS data
Next Topic: DOTS OR MISSING VALUES IN BREASTFEEDING SURVEY
Goto Forum:
  


Current Time: Thu Mar 28 05:42:44 Coordinated Universal Time 2024