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
Evaluating multivariable functions in StataI'm wondering if Stata can evaluate multivariable functions. Specifically, I have a function that ha…
Testing coefficients from two different samples using xtregDear All, I have seen several postings on the test of coefficients coming from two different xtreg m…
"Over", "subpop" and "if" options produce different means in svy: means, in the presence of post-stratification weightsHi All, Background: I am working with a client who phone-based information services and they would …
panel logistic regression with year dummiesHi statalists, I have unbalanced panel data for a set of firms for the period that extends from (201…
Replace "Null"l by "" in a large datasetDear all, I have 1100 variables in my dataset. How can I replace "Null" by " " in the string variab…
Subscribe to:
Post Comments (Atom)
0 Response to Averaging year and outcome variables for panel data
Post a Comment