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.)
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: 3214
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.

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


Current Time: Fri Dec 20 21:25:48 Coordinated Universal Time 2024