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
Generating a dummy variable for observations within anotherHi everyone, I am having some problems in generating a variable matching two observations within the…
Proportions in stata between 4 groupsHello All, I am trying to calculate proportions along with their difference, P value and CI's betwe…
Identifying specific patterns in longitudinal ratings dataHello forum participants, I am seeking your feedback in relation to the following task associated w…
Stata Dialogue ProgrammingI was searching the documents and internet sources for an example on using radio buttons in dialogue…
Increasing inner graph region to allow longer categorical x axis labels without overlapping – catplot with splitvallabelsDear Statalist, I am plotting a horizontal bar chart using catplot. Each categorical x axis label is…
Subscribe to:
Post Comments (Atom)
0 Response to Averaging year and outcome variables for panel data
Post a Comment