- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 14446 个
- 通用积分
- 1962.3850
- 学术水平
- 1119 点
- 热心指数
- 1167 点
- 信用等级
- 1061 点
- 经验
- 8523 点
- 帖子
- 1629
- 精华
- 1
- 在线时间
- 2492 小时
- 注册时间
- 2010-10-10
- 最后登录
- 2025-12-19
|
- // Double graph - if there is too much detail for one
- // graph then 2 graphs can be used
- clear
- set more off
- use "http://www.stata-press.com/data/r11/nlswork2.dta"
- describe
- replace year=1900+year
- gen age11= yofd(date(c(current_date)),"DMY") -(1900+birth_yr)
- recode age11 (56/58=1) (59/61=2) (62/64=3) (65/67=4) (68/70=5)
- collapse (count) union (count) idcode ,by(year age11)
- gen per=(union/idcode)*100
- twoway ///
- (line per year if age11==1 , lpattern(dash) connect(l)) ///
- (line per year if age11==2 , lpattern(dash_dot) connect(l)) ///
- (line per year if age11==3 , lpattern(dot) connect(l)) , ///
- name(a1,replace) legend( bmargin(l=40) stack region(style(none)) ///
- label( 1 "56-58") ///
- label( 2 "59-61") ///
- label( 3 "62-64") ///
- rows(1) ) xtitle("") ///
- xlabel(1968 " 1968" 1978 "1978 ", noticks)
-
- twoway ///
- (line per year if age11==4 , yaxis(1) lpattern(solid) connect(l)) ///
- (line per year if age11==5 , yaxis(1) lpattern(longdash) connect(l)), ///
- name(a2,replace) legend( bmargin(r=40) stack region(style(none)) ///
- label(1 "65-67") ///
- label( 2 "68-70") ///
- rows(1) ) xtitle("") ///
- xlabel(1968 " 1968" 1978 "1978 ", noticks) ///
- yscale(alt) xline(1968)
- graph combine a1 a2 , imargins(zero) ycommon
复制代码
|
|