noconstant
ラッパー プログラムから内部regress
呼び出しにオプションを渡したいと思います。次の解決策は機能しますが、いくつかのオプションを渡したい場合は、特にぎこちなく、拡張できないようです。
webuse grunfeld, clear
capture program drop regress_wrapper
program define regress_wrapper
version 11.2
syntax varlist(min=2 numeric) [if] [in] ///
[, noconstant(string)]
tokenize `varlist'
local y `1'
macro shift
local x `*'
regress `y' `x', `noconstant'
end
regress_wrapper invest mvalue kstock
regress_wrapper invest mvalue kstock, noconstant(noconstant)
次のようなものがうまくいくと思いましたが、noconstant
オプションを渡しません。
capture program drop regress_wrapper
program define regress_wrapper
version 11.2
syntax varlist(min=2 numeric) [if] [in] ///
[, noconstant]
tokenize `varlist'
local y `1'
macro shift
local x `*'
regress `y' `x', `noconstant'
end
regress_wrapper invest mvalue kstock
regress_wrapper invest mvalue kstock, noconstant