画了一幅有一点复杂的stata图,但是不知在do file中命令应该按什么格式输入。在command窗口连起来输入以下的命令,就运行得很好,图很美观,符合我的想法。
twoway(scatter total pergdp1, mlabel(country) mlabv(pos))(line heduhat pergdp1, sort), xscal(log) xlabel(.5 5 10 20 30 40, grid) legend(off) title("GINI vs. GDP per capita") note("Data source: World bank, 2002") ytitle("GINI Index")
但按可读的方式(非长长的一串)输入do file时,就发现无法画出相同的图了。
在连老师初级视频中发现老师是这样在do file中呈现的,运行得很好:
sysuse sp500, clear
twoway (line high date) (line lowdate)
///
,
/*逗号后全部为选项*/
///
title("图1:股票最高价与最低价时序图",boxmargin(medsmall)) ///
xtitle("交易日期",margin(medsmall))
///
ytitle("股票价格")
///
ylabel(900(200)1400)ymtick(##5)
///
legend(label(1 "最高价") label(2 "最低价"))
///
note("资料来源:Stata公司,SP500.dta")
///
caption("特别说明:这是我做的第一幅Stata图形!")
那我应该怎么给我的命令分段呢?我是这样做的:
twoway(scatter total pergdp1, mlabel(country) mlabv(pos))(line heduhat pergdp1, sort) ///
, ///
xscal(log)///
xlabel(.5 5 10 20 30 40, grid)///
legend(off) title("GINI vs. GDP per capita")///
note("Data source: World bank, 2002")///
ytitle("GINI Index")///
结果显示错误。然后我每行的///删掉,画出来的就不是自己设定的(没有了option),只能画graph-plot command部分。
我应该如何在do file中呈现这个图呢?是不是我没有像连老师那样每行空出那么多呢?
我还看到连老师教程中有#delimit ; #delimit cr命令,我常看到其在画图中出现,这个不是规定“;“来分段的意思吗?在画图中什么用? 我的问题是出在这里吗?
感谢连老师指导!


雷达卡




京公网安备 11010802022788号







