Hello,
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
The way I've done it so far is like this, but I am not sure if it was okay to do so. Tsline is for time series data, and this panel data.
Code:
gen id = _n

xtset id year

preserve 
collapse (median) wealth [weight=weight], by(year race school)
graph twoway tsline wealth, by(race school)
I could use xtline (with the option "overlay") instead, but I still don't know if it was appropriate to use and create an "id". What should I do? Thank you!