使用do-file和本地宏

Met*_*ics 1 global-variables local-variables stata stata-macros

我在使用do带有本地宏的文件时在Stata中收到以下错误:

clear 
capture log close

sysuse auto,clear 
log using stata,text replace

local varlist  price mpg rep78 weight length
reg 'varlist'
local close
Run Code Online (Sandbox Code Playgroud)

产量

local varlist  price mpg rep78 weight length

reg 'varlist'
invalid name
Run Code Online (Sandbox Code Playgroud)

我知道这是一个非常微不足道的问题,但我不确定这个错误来自何处.

请注意,当我使用全局宏时,我没有收到错误.

Ric*_*ron 6

要取消注册本地宏,左引号应该是反引号.请尝试以下方法.

regress `varlist'
Run Code Online (Sandbox Code Playgroud)

反引号与大多数键盘上的波浪号(即〜)位于相同的键上.