I have UK panel data from the British Household Panel Survey and Understanding data, covering 2000-2016 in a variable "year" with individual identifiers "pidp".
How do I keep those variables that appear at least once before 2007 and at least once after 2007 - I am looking the impact of a UK policy that came into effect and hence am trying to limit the sample to those individuals that appear both before and after the threshold?
I have tried a combination of the following, limiting to those who only answered for than say 9 years to ensure they are before and after but this greatly limits the data:
bysort pidp : drop if _N < 2 //*13,495
bysort pidp : drop if _N < 3 //*16, 530
bysort pidp : drop if _N < 4 //*17,190
bysort pidp : drop if _N < 5 //*15,936
bysort pidp : drop if _N < 6 //*18,120
bysort pidp : drop if _N < 7 //*21,522
bysort pidp : drop if _N < 8 //*28,924
bysort pidp : drop if _N < 9 //*32,080
Thanks,
Joshua
Related Posts with Panel Data - Keeping Observations when using a Difference in Difference Approach
Matching observations in a quasi-random processDear Statalisters, I want to create a set of observations which is used to test different models la…
Spatgsa - dimension of the matrix vs number of observationsDear Statalist members, I have an identical problem as the one previously published in the forum: h…
Where to Specify Temporary Names for Local Macros Inside Ado FilesStata Listers: I have a general question about where to specify temporary names for local macros in…
Reporting odds ratio for quantile regressionIn Stata 14 I can report odds ratios for OLS regression by adding Code: , eform(exp(Coef.)) But n…
Running Two Limit Tobit modelHello, I have been attempting to run a Two Limit Tobit model on my data. I have a relatively large d…
Subscribe to:
Post Comments (Atom)
0 Response to Panel Data - Keeping Observations when using a Difference in Difference Approach
Post a Comment