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
Margins and standard errors with population data - vce(unconditional) or vce(delta)?Hi everybody I have panel data for the entire population. I run my regression and use the margins-c…
How to save table from -pstest- command?Hi there, My goal is to save the table produced by the command -pstest-, preferably to word but I w…
covariance structure for melogit model with random slopesHi all, I've been trying to better understand the covariance structure to select for a multilevel l…
Inserting value of a string in a filename when exportingIs there a way to pull the value of a string variable into the part of a collect export command so t…
Interpreting results of npregress series (polynomial)Hello Everyone, Am working on Stata 17. Following are my code and output: Please note that Y is a …
Subscribe to:
Post Comments (Atom)
0 Response to Panel Data - Keeping Observations when using a Difference in Difference Approach
Post a Comment