Announcement

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

  • Assigning weight using loop function

    I am working on a survey data collected at 3 stages consisting of villages, enumeration blocks and households. Villages have been selected using PPS method. I have assigned the village level weights manually in stata using the following syntax repeating it as many villages I have :

    replace weight=xxxx if block_code ==1 & eb_no__eb_code==yyy

    Now enumeration blocks, households and individuals are nested consecutively. I have 2000 individual samples and I want to assign design weight at individual level. I like to know what s the appropriate syntax for this using looping function.

    Thanx in advance.

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    I don't fully understand your problem. Generally, you can assign weights just with different if conditions. If you need to specifically assign 2000 different weights, then a loop won't necessarily help much. Someone on the listserve (I think Clyde S) has suggested setting up a separate data file with just id's and weights. Then merge this by id with your main data. However, some of the survey estimators may be able to handle this in the estimation rather than pre-calculation.

    Comment

    Working...
    X