如何在Stata中运行另一个ado文件中的ado文件?
运行另一个 R 脚本
source("script.R")
在 R 中,我可以使用How can I do the same in Stata?
In R, I can run another R script using
source("script.R")
How can I do the same in Stata?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Stata 中,有两种类型的脚本:
还有
主要区别在于,要执行 do 文件,您需要
do
它或run
它:显示输出,并
抑制输出。
自动加载的do-files,顾名思义,是自动加载的。当您输入
Stata 时,它首先会在内存中查找程序
blah
。如果不存在,它将在其adopath
中标识的子目录中查找文件blah.ado
,默认情况下包括 Stata 自己的目录以及当前目录(如果您有兴趣,请输入adopath
以了解更多信息)。如果它找到这个blah.ado
,它会 (1) 确保其中有program Define blah
,并且 (2) 尝试使用您指定的任何参数执行该程序提供(blah1 blah2
)。如果它无法在任何地方找到文件blah.ado
,它将发出错误消息:In Stata, there are two types of scripts:
and
The primary distinction is that to execute the do-file, you need to
do
it orrun
it:shows the output, and
suppresses the output.
The automatically loaded do-files, as the name implies, are loaded automatically. When you type
Stata will first look for the program
blah
in its memory. If it is not there, it will look for fileblah.ado
in the subdirectories identified in itsadopath
that by default includes Stata's own directories, as well as the current directory (typeadopath
to find out more, if you are interested). If it finds thisblah.ado
, it will (1) make sure it hasprogram define blah
inside it, and (2) try to execute this program with whatever arguments you supplied (blah1 blah2
). If it fails to find the fileblah.ado
anywhere, it will issue an error message:Stata 将在默认目录中搜索 ado 文件,如顶部答案所示。要查看系统默认目录,请键入:
。 sysdir
您可以手动将 ado 文件的目录(例如,个人路径)更改为您喜欢的文件夹,使用:
。 sysdir 设置个人“C:\your-ado-folder”
信用:https://kb .iu.edu/d/arur
Stata will search for the ado file in the default directories as the top answer indicated. To see your system default directories, type:
. sysdir
You can manually change the directory (e.g., the PERSONAL path) for ado files to the folder you like, using:
. sysdir set PERSONAL "C:\your-ado-folder"
Credit: https://kb.iu.edu/d/arur