在批处理模式下的Stata命令行参数 [英] Stata command line arguments in batch mode
问题描述
A <一个href=\"http://www.stata.com/support/faqs/programming/passing-arguments-to-do-files/index.html\">helpful从Stata的常见问题解答介绍的参数可以传递到做
文件。我的不要
文件看起来是这样的:
A helpful FAQ from Stata describes that arguments can be passed to do
files. My do
file looks like this:
* 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
据的FAQ,该脚本可以使用运行不要filename.csv result.dta code>。当我从内塔塔运行此命令,一切工作正常。该计划是漫长的,但是,所以我想在批处理模式下运行它。塔塔拥有另一个常见问题了解批处理模式。
According to the FAQ, this script can be run using do filename.csv result.dta
. When I run this command from within Stata, everything works fine. The program is long, however, so I want to run it in batch mode. Stata has another FAQ about batch mode.
从结合这些网页的信息,我请在我的Unix提示符下输入:
Combining the information from these webpages, I type the following at my Unix prompt:
$ nohup stata -b do program.do filename.csv result.dta &
Stata的启动,但它与以下错误而终止:
Stata starts up, but it terminates with the following error:
. save `outname', emptyok // file to hold results
invalid file specification
r(198);
一个小实验告诉我,塔塔从来没有收到这两个参数,当我以批处理方式运行该程序。该如何解决这个问题? (也就是你如何在批处理模式下运行时,它传递参数给一个做文件?)
A little experimentation tells me that Stata is never receiving the two arguments when I run the program in batch mode. What is the solution to this problem? (i.e. how do you pass arguments to a do file when running it in batch mode?)
推荐答案
下面的线程可能会有所帮助:
The thread below may be helpful:
http://www.stata.com/statalist/archive/ 2012-09 / msg00609.html
在Windows中,如果我的程序 Test.do
是:
In Windows, if my program Test.do
is:
args a b
display "`a'"
display "`b'"
我可以通过简单地输入在Windows批处理模式下运行:
I can run it in batch mode in Windows by simply typing:
C:\\ Stata13 \\ stata.exe/ E做C:\\脚本\\ Test.do测试脚本
和它就会显示(在塔塔):
And it will display (within Stata):
测试
剧本
所以,我想知道是否的nohup
是什么$ P $从工作pventing程序。
So I wonder whether the nohup
is what's preventing your program from working.
这篇关于在批处理模式下的Stata命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!