Announcement

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

  • Using svyset and switching between two datasets with two-stage design

    I have two datasets of a sample that were created using Probability Proportional to Size (PPS) sampling in a two-stage design with strata. The sample is of childcare centers:
    1. A sample of childcare centers was selected with PPS, stratified by provider model
    2. Within each center, 1-2 classrooms were randomly selected with equal probabilities
    I have a dataset of director surveys (one per center) and a dataset of caregiver surveys (1-2 per center). Since PPS was used, each dataset has probability weights, so I am using svyset and the svy prefix for commands.

    In the do file I'm working on, I have to frequently switch between the two datasets. In both datasets, the weight variable has the same name, although the value differs. For example, it might look like this in the director survey dataset:
    Provider Center_ID Weight
    1 101 7.6014171
    1 102 4.0412597
    2 201 2.6494566
    3 301 3.7340294
    3 302 9.8233698
    And this in the caregiver dataset:
    Provider Center_ID Clasroom_ID Weight
    1 101 10101 17.422834
    1 101 10102 17.422834
    1 102 10201 11.333779
    2 201 20101 6.7823697
    3 301 30101 10.430736
    3 301 30102 10.430736
    3 302 30201 21.57423
    I set up the weights like this:

    Code:
    svyset Centro_ID [pw=Weight], str(Provider)
    I understand that this command is correct for both datasets, although including Center_ID in the command for the director survey dataset is unnecessary.

    Do I need to reset svyset every time I switch between datasets, or is it sufficient to just do this at the begninng of the do file?
    Last edited by Daniel Jensen; 14 Mar 2020, 17:13.
Working...
X