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
java.lang.NoSuchMethodError + Stata 15.1Hi, It is my first time on this website, recently I had the error regarding java in Stata 15.1 , on …
xtscc for panel data with fixed effectsDeal All, I am working with a large panel data (27 countries and 100 years). When doing robustness …
Calculating Margins to Interpred Ordered LogitHi Statlisters, I am estimateing an ordered logit model within my panel data set. Code is Code: …
Interpreting "estat vce, corr output" postetimation of menbreg with random slope and interceptHi everyone, I am interested in getting some assistance interpreting the output of a estat vce, corr…
Specify number of iterations to fit an fmm model that is not concaveHi Statalist, I'm using fmm: logit in Stata 15.1. My dataset contains ~21000 observations and I'm t…
Subscribe to:
Post Comments (Atom)
0 Response to Deleting observations from a panel data according to a criteria
Post a Comment