【发布时间】:2013-06-22 18:16:39
【问题描述】:
helpful FAQ from Stata 描述了可以将参数传递给do 文件。我的do 文件如下所示:
* program.do : Program to fetch information from main dataset
args inname outname
save `outname', emptyok // file to hold results
insheet using `inname', comma clear names case
// a bunch of processing
save `outname', replace
根据常见问题解答,此脚本可以使用do filename.csv result.dta 运行。当我从 Stata 中运行此命令时,一切正常。但是,该程序很长,因此我想以批处理模式运行它。 Stata 有another FAQ 关于批处理模式。
结合这些网页的信息,我在 Unix 提示符下键入以下内容:
$ nohup stata -b do program.do filename.csv result.dta &
Stata 启动,但因以下错误而终止:
. save `outname', emptyok // file to hold results
invalid file specification
r(198);
一个小实验告诉我,当我以批处理模式运行程序时,Stata 永远不会接收到这两个参数。这个问题的解决方案是什么? (即在批处理模式下运行时如何将参数传递给 do 文件?)
【问题讨论】:
-
看来你不能这样做。
标签: arguments batch-processing stata