【发布时间】:2014-08-26 15:09:41
【问题描述】:
我目前正在创建一个循环,它将针对不同区域运行回归。我试图运行的回归是:
reg x1 x2 x3 if Region==n
其中 n=1,2,3,4,5,6。
通过手动输入单独运行它们很好,但是在尝试运行我编写的以下循环时:
local Region "1 2 3 4 5 6"
foreach i of local 'Region' {
reg x1 x2 x3 if Region== 'i'
}
它报告错误:
'i' invalid name
r(198);
谁能提出一些建议来纠正这个错误?
【问题讨论】:
-
foreach i of local 'Region'应该是foreach i of local Region。此外,您可以在定义本地时省略“”。