批处理模式下的Stata命令行参数

Chr*_*isP 5 arguments batch-processing stata

Stata的一个有用的FAQ描述了可以将参数传递给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
Run Code Online (Sandbox Code Playgroud)

根据FAQ,可以使用此脚本运行do filename.csv result.dta.当我从Stata中运行此命令时,一切正常.但是程序很长,所以我想以批处理模式运行它.Stata还有另一个关于批处理模式的FAQ.

结合这些网页的信息,我在Unix提示符下键入以下内容:

$ nohup stata -b do program.do filename.csv result.dta &
Run Code Online (Sandbox Code Playgroud)

Stata启动,但它终止时出现以下错误:

. save `outname', emptyok // file to hold results
invalid file specification
r(198);
Run Code Online (Sandbox Code Playgroud)

一些小实验告诉我,当我以批处理模式运行程序时,Stata永远不会收到两个参数.这个问题的解决方案是什么?(即在批处理模式下运行参数时如何将参数传递给do文件?)

Luc*_*yer 5

以下主题可能会有所帮助:

http://www.stata.com/statalist/archive/2012-09/msg00609.html

在Windows中,如果我的程序Test.do是:

args a b
display "`a'" 
display "`b'" 
Run Code Online (Sandbox Code Playgroud)

我可以在Windows中以批处理模式运行它,只需输入:

"c:\Stata13\stata.exe" /e do "c:\Scripts\Test.do" Test Script

它将显示(在Stata内):

Test

Script

所以我想知道nohup是什么阻止了你的程序工作.