Dear Community,
I have 106 groups, which I will call "strata groups", with subjects that come from two datasets, which I'll call Dataset A and Dataset B. The strata groups are the product of a stratification procedure, so the subjects are observationally similar across a vector of covariates. The subjects from Dataset A have a score that I am calling the "selection score". The subjects from Dataset B do not have this score.
Within each strata group, I would like to randomly assign selection scores to subjects from Dataset B (who are missing scores) using the scores from subjects from Dataset A. In other words, I would like to randomly draw a number from a set of selection scores observed for Dataset A and assign that number to each subject in the strata group that is from Dataset B. The distribution of scores in each strata group is uniform (most scores are only observed once).
The strata groups have different proportions of subjects from each dataset. So, in some strata groups there is only one subject from Dataset A and many subjects from Dataset B. In that case, all of the subjects from B should have the value from A.
I have attempted to do this a number of different ways, but I have not been able to figure this out. Is someone able to offer a suitable looping code to help me generate these scores? I am using Stata/SE 14.2 on a Mac.
Stacy
I have 106 groups, which I will call "strata groups", with subjects that come from two datasets, which I'll call Dataset A and Dataset B. The strata groups are the product of a stratification procedure, so the subjects are observationally similar across a vector of covariates. The subjects from Dataset A have a score that I am calling the "selection score". The subjects from Dataset B do not have this score.
Within each strata group, I would like to randomly assign selection scores to subjects from Dataset B (who are missing scores) using the scores from subjects from Dataset A. In other words, I would like to randomly draw a number from a set of selection scores observed for Dataset A and assign that number to each subject in the strata group that is from Dataset B. The distribution of scores in each strata group is uniform (most scores are only observed once).
The strata groups have different proportions of subjects from each dataset. So, in some strata groups there is only one subject from Dataset A and many subjects from Dataset B. In that case, all of the subjects from B should have the value from A.
I have attempted to do this a number of different ways, but I have not been able to figure this out. Is someone able to offer a suitable looping code to help me generate these scores? I am using Stata/SE 14.2 on a Mac.
Stacy
Comment