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
Can a marginal effect be -1.37?After running a xtlogit model with an interaction term between a score (continuous variable) and res…
geocoding addresses to US census block groups and automationThe US Census has a neat online tool that lets you get the census tract and block group codes for up…
Share of working hour of an occupation in whole industryHello, I've been working CPS basic monthly sample and in the below data sample ahrswork1 stands for…
Using a td() Function with a min() Function with Local MacroI am attempting to display the minimum value of a local macro in a tm() format: A. local VLM 720 72…
Stack constant after running multiple regressionsDear all, Please kindly help. I would like to report the constants clearly after running my regress…
Subscribe to:
Post Comments (Atom)
0 Response to Averaging year and outcome variables for panel data
Post a Comment