regress 油耗 重量
putdocx table tbl_reg = etable
regress 油耗 重量 i.国籍 i.维修记录78
margins 国籍 维修记录78
putdocx table tbl_marg = etable
quietly regress 油耗 重量 变速比 转弯半径
estimates store 模型1
quietly regress 油耗 重量 变速比 转弯半径 国籍
estimates store 模型2
estimates table 模型1 模型2, ///
varlabel b(%7.4f) ///
stats(N r2 r2_a) star
putdocx table tbl_est = etable
putdocx table tbl_data = data(_all)
// 去除边界
putdocx table tbl_data_1 = data(_all), border(all,nil)
// 改变第一行边界
putdocx table tbl_data_1(1,.), border(bottom,double)
putdocx table tbl_data_1(3,.), border(bottom, dotted)
// 扩展第一格占三列
putdocx table tbl_data_1(1,1), colspan(3) halign(center)
putdocx table tbl_data_1(14,.), border(top,dotted)
putdocx table tbl_data_1(17,.), border(top,double)
// 扩展17,18行第一格占三列,对齐左侧, 斜体
putdocx table tbl_data_1(17,1), colspan(3) halign(left) italic
putdocx table tbl_data_1(18,1), colspan(3) halign(left) italic
// table may be created in memory using -memtable- option
regress 油耗 重量 if 国籍, cformat(%9.4f)
putdocx table tbl_f = etable, memtable
regress 油耗 重量 if !国籍, cformat(%9.4f)
putdocx table tbl_d = etable, memtable
// add tables in memory into cells of another tbale
putdocx table tbl_l = (2, 2)
putdocx table tbl_l(1, 1) = ("国外"), halign(center)
putdocx table tbl_l(1, 2) = ("国内"), halign(center)
putdocx table tbl_l(2, 1) = table(tbl_f)
putdocx table tbl_l(2, 2) = table(tbl_d)
dyndoc fuel.txt, replace
<<dd_do>>
use examples/auto_zh.dta, clear
regress 油耗 重量
<</dd_do>>
. use examples/auto_zh.dta, clear
(1978年汽车数据)
. regress 油耗 重量
Source | SS df MS Number of obs = 74
-------------+---------------------------------- F(1, 72) = 194.71
Model | 87.2964971 1 87.2964971 Prob > F = 0.0000
Residual | 32.2797637 72 .448330051 R-squared = 0.7300
-------------+---------------------------------- Adj R-squared = 0.7263
Total | 119.576261 73 1.63803097 Root MSE = .66957
------------------------------------------------------------------------------
油耗 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
重量 | .003102 .0002223 13.95 0.000 .0026589 .0035452
_cons | .7707669 .3142571 2.45 0.017 .1443069 1.397227
------------------------------------------------------------------------------
改变标签属性
<<dd_do:quietly>>
matrix eb = e(b)
<</dd_do>>
<<dd_do>>
scatter 油耗 重量, mcolor(%50)
<</dd_do>>
<<dd_graph:sav(sc_gp100m_weight.png) replace>>
<<dd_skip_if: ("`details'"=="")>>
等速油耗是指汽车在良好路面上作等速行驶时的燃油经济性指标。
<<dd_skip_end>>
<<dd_include: /path/file>>
# 标题 1
## 标题 2
### 标题 3
"~~~~" 或 "````"代码块
asterisks (*) underscores (_)重点
![Alt text](/path/to/img.jpg "Optional title")
This is [an example](http://example.com/ "Title") link.
dyndoc fuel_consumption.txt, replace
从一个动态文件应用参数生成一组网页
ssc 使用pandoc to convert Markdown documents:
// web page
dynpandoc fuel_cc.txt, saving(fuel_pandoc.html) ///
from(markdown) replace
// docx
dynpandoc fuel_cc.txt, saving(fuel_pandoc.docx) ///
from(markdown) replace ///
pargs("--reference-doc=reference.docx")
// PDF
dynpandoc fuel_cc.txt, saving(fuel_pandoc.pdf) ///
from(markdown) replace