I have a dataset which is too large to load completely in Stata and want to draw a subsample on a condition, basically people should have at least one spell == X in a specific year.
Thats why the normal
doesnt work because I want all spells of the person with that condition, not just the spell for which the condition is true.
The easy but inefficient way would be to load the person ids of people who satisfy the condition and then merge them onto to the entire dataset. But that would require loading the whole dataset. An alternative would be to write a loop and merge the person id's over slices of the original data. That could be feasible.
Anyway, are there more clever ways that I am missing to deal with this?
Thats why the normal
Code:
use vars using data if spell==X
The easy but inefficient way would be to load the person ids of people who satisfy the condition and then merge them onto to the entire dataset. But that would require loading the whole dataset. An alternative would be to write a loop and merge the person id's over slices of the original data. That could be feasible.
Anyway, are there more clever ways that I am missing to deal with this?
Comment