I'd like to graph the median values of a variable. The data I have looks like this, and I would like to graph median GPA over time by race and by school. There are no unique identifiers for individuals. The survey design is a rotating panel.
weight | year | age | school | race | gpa |
100 | 1910 | 5 | elementary | white | 3 |
200 | 1910 | 10 | elementary | black | 2 |
300 | 1910 | 12 | middle | other | 4 |
400 | 1911 | 14 | middle | black | 3 |
100 | 1911 | 18 | high | black | 4 |
300 | 1911 | 32 | no college | other | 2 |
Code:
gen id = _n xtset id year preserve collapse (median) wealth [weight=weight], by(year race school) graph twoway tsline wealth, by(race school)
0 Response to Graphing Medians Panel Data
Post a Comment