If we collapse data, we essentially create new data set containing averaged values. By creating by group variables, we exhaust memory in creating new variables. Please consider the following data :-
Code:
use http://www.stata-press.com/data/r13/xtline1 xtset person day xtline calories, overlay
Code:
use http://www.stata-press.com/data/r13/xtline1, clear gen month = month(day) bys person month: egen monthly_cal = sum(calories) bys person month: gen dup = _n keep if dup ==1 drop dup xtset person month xtline monthly_cal, overlay
Thanks,
Kedar
0 Response to Overlay graphs in Panel data without -collapse- or creating by group averages
Post a Comment