Append Esttab:附加带有分页符的rtf文件?

Append Esttab:附加带有分页符的rtf文件?,append,stata,page-break,Append,Stata,Page Break,我使用循环将各种因变量的每个回归表附加到一个文件中: global all_var var1 var2 var3 foreach var of global all_var { capture noisily : eststo mod0: reg `var' i.female capture noisily : eststo mod1: reg `var' i.female capture noisily : eststo mod2: reg `var' i.female estta

我使用循环将各种因变量的每个回归表附加到一个文件中:

global all_var var1 var2 var3

foreach var of global all_var {

capture noisily : eststo mod0: reg  `var' i.female
capture noisily : eststo mod1: reg  `var' i.female
capture noisily : eststo mod2: reg  `var' i.female

esttab mod0  mod1  mod2  using "file_name.rtf", append
}
然而,在最后的
rtf
文件中,有些表被拉伸到了两页,看起来不太好

有什么方法可以避免这种情况,例如引入某种分页符?

社区贡献包
rtfutil
提供了一种解决方案:

net describe rtfutil, from(http://fmwww.bc.edu/RePEc/bocode/r)

TITLE
      'RTFUTIL': module to provide utilities for writing Rich Text Format (RTF) files

DESCRIPTION/AUTHOR(S)
      
        The rtfutil package is a suite of file handling utilities for
      producing Rich Text Format (RTF) files in Stata, possibly
      containing plots and tables. These RTF files can then be opened
      by Microsoft Word, and possibly by alternative free word
      processors. The plots can be included by inserting, as linked
      objects, graphics files that might be produced by the graph
      export command in Stata. The tables can be included by using the
      listtex command, downloadable from SSC, with the handle() option.

确切的语法将取决于您没有提供任何示例数据的特定用例。

安装rtfutil后,您可以使用rtfappend。假设您希望在mod1和mod2之间使用分页符

    esttab mod0 mod1 using "file_name.rtf", replace
    tempname handle
    rtfappend `handle' using "file_name.rtf", replace
    file write `handle' "\page" _n
    rtfclose `handle'
    esttab mod2 using "file_name.rtf", append
如果需要换行符,只需将\page替换为\line即可