Hi,
I am quite new to STATA (shame on me) and am trying to figure out how to get a desired dataset from a big longitudinal dataset. I have a balanced dataset with individuals (id) over 9 years (2006-2014). But I am not interested in all of them. I only want to have a dataset of individuals who lived in two groups of districts in the first 5 years (2006-2010). So let's say one set contains Treatment={a, b, c, d} and the other set contains Control={e, f, g, h}.
So for each id in the dataset, check if
-for all t from 2006 to 2010 if id(district) is in Treatment then keep
OR
-for all t from 2006 to 2010 if id(district) is in Control then keep
IF NEITHER HOLDS
then delete the id and all observations for all variables for all the years in the dataset (i.e. 2006-2004).
I know in my head what I want STATA to do, but I cannot write the code for it.. I am sorry if it is a too primitive question. I hope I'll improve over time and come with better questions.
Best,
Merve
Related Posts with Deleting observations from a panel data according to a criteria
Help Required with Value Weighted PortfoliosDear Statalist users, following is a sample from my dataset Code: * Example generated by -dataex-.…
Effect of fixed-, random effects models or regression model with robust standard errors on the "regression model"Hello! If i run a regression with the xtreg command on panel data using different models such as fi…
how to analyze the data for measuring multiply site from same patients? Repeated Measures Analysis of Variance (ANOVA)?I am doing a study to evaluate the effect of ossification ligament on thoracic vertebra. The purpose…
strange variablesI have a dataset with strange variables and I can't work with it. tried "destring", "split" in vain …
Hausman test on several modelsHello, I (- am using Stata 14.2- ) have a panel data set with about 3.000 observations over 10 year…
Subscribe to:
Post Comments (Atom)
0 Response to Deleting observations from a panel data according to a criteria
Post a Comment