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
Creating a loop for estimating probabilities using mlogitHello, Since the mlogit is not a panel estimator I want to estimate a cross sectional model but for…
Looping through a panel with dfullerHi everyone, I would like to test an unbalanced panel for unit roots and store the results by group…
Panel Data Scatter Plot Not Displaying All DataI'm trying to create a nice scatter plot with some panel data that's coloured, the problem is that i…
SVYSET issuesHello, I am having some trouble with the svyset command. There was an earlier post from a year ago …
Choosing the right modeling technique available in STATADear Stata Experts: I am working on a project to predict state policy on a particular issue. The ob…
Subscribe to:
Post Comments (Atom)
0 Response to Panel Data - Keeping Observations when using a Difference in Difference Approach
Post a Comment