Hi STATA community,
I was browsing through forum questions regarding averaging year and outcomes on panel data and got some helpful starting points, but nothing came up that exactly addressed the same issues I'm getting in setting this up, so thanks in advance for any advice on this!
I have 10 years of panel data that has Year | School | Grade | Outcome 1 | Outcome 2 | Treatment | etc... Since it's year by grade, there are repeated years throughout by grade (ex: 2007 repeated 12 times for grade 1, grade 2, grade 3, etc.). I want to be able to create a graph that has the Outcome range on the y-axis, Years on the x-axis. I would like to add two lines in the graph, one for treated (treatment = 1) and one for untreated (treatment =0). I'm hoping to compare treated versus untreated schools on outcomes over the series of years.
I started with averaging year*grade:
generate school_grade_year=.
replace school_grade_year=2010 if YEAR== 2010 &(GRADE >=3 & GRADE <=12)
Then I got Outcome averages:
bysort school_grade_year: egen school_year_outcome1 = mean (outcome1)
I'm not sure if that's enough, because although I have the averages, obviously the Year is still repeated since grade hasn't been filtered out because I still need to filter by treatment =1 or treatment =0 by school. So I went to create a line graph, it says I can't have Year on the x-axis due to repeated school years.
Can someone advise on how I should go about setting this up to create the graph I want? Much appreciated.
Related Posts with Averaging year and outcome variables for panel data
Generalized Hausman test 'suest' after GMM estimation 'xtdpdgmm'Dear friends, I am trying to run a 'suest' generalized Hausman test after 'xtdpdgmm' estimation, I d…
bayerhanck errorDear community, I am trying to run a bayerhanck cointegration command for a time series model contai…
Drop values that are more than 0.1 decimal pointsDear all I have a simple question but not sure how to address it. I have the following dataset Co…
margins, dydx() questionHi, Just a quick question. Just say you were to find a significant interaction between two categor…
RDD with multivariate local-linear regressionGreetings to everyone, For my research, I am conducting an RD analysis where in addition to the run…
Subscribe to:
Post Comments (Atom)
0 Response to Averaging year and outcome variables for panel data
Post a Comment