Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I count up the total number of households?

    Hi,

    I am working on a panel, and I want to know how many households were surveyed in a specific year. When I tabulate the number of households, I get the full list for that year, but they are double counted or show up twice. They show up twice because it means that more than one individual took the survey from that household. Does anyone know if their is a code that I can put in Stata where I can count how many households their actually were while avoiding the double counting?

    Thanks!

  • #2
    Welcome to Statalist!

    Assuming you have a household identifier variable named hhid, the command
    Code:
    egen household = tag(hhid)
    will create the variable household which will be 1 for only one observation for each unique value of hhid and 0 otherwise. So then if you run your tab with if household==1 or even just if household as part of the command you should get the counts you are looking for. This will also work to tab any variables that are the same for every member of the household, but something like age or gender won't work, of course.

    Comment


    • #3
      Thanks! It worked!

      Comment

      Working...
      X