相关疑难解决方法(0)

Stata是否有类似于Java的"try and catch"机制?

我写的.do是检查一些.dta文件中是否存在某些变量,以及检查这些变量是否存在某些值.但是,我的代码在遇到无效的变量名时停止执行.

我知道我混合Java和Stata编码,这是完全不合适的,但有什么方法可以做我喜欢的事情:

try {
su var1
local var1_mean=(mean)var1
local var1_min=(min)var1
local var1_max=(max)var1
...
}
catch (NoSuchVariableException e) {
System.out.println("Var1 does not exist")
}
// So that the code does not stop executing...?
Run Code Online (Sandbox Code Playgroud)

java try-catch stata

10
推荐指数
1
解决办法
4478
查看次数

标签 统计

java ×1

stata ×1

try-catch ×1