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:
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:
And this in the caregiver dataset:
I set up the weights like this:
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?
- A sample of childcare centers was selected with PPS, stratified by provider model
- Within each center, 1-2 classrooms were randomly selected with equal probabilities
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 |
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 |
Code:
svyset Centro_ID [pw=Weight], str(Provider)
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?