Hi Statalist users,
I need advice on the following problem.
Suppose I have two macros
local b "b1 b2"
local var "var1 var2"
What would be an elegant way to create macro that contains a string "b1*var1+b2*var2"?
Just to place it into context -- I want to compute fitted value that is based on a regression prediction, but not for all Xs. Something along these lines (but it needs to be general solution for any subset of independent variables):
reg y X1 X2 X3
gen yhat=_b[X1]*X1+_b[X2]*X2
Thanks, Oleksandr
Related Posts with Form a text string of scalar product of two macros
Plotting a (curvilinear) mediated relationI am working with a mediated-moderated model like that in Fig. 1. All variables in the model are con…
Can anyone explain to me what the meaning of %9.0g is?I'm confused about Stata formats. I try to see Stata help format file, but I'm still confused. …
How to check correlation among 2000+ variables in a quick way?Hi, all, I had a data set of 2000+ variables (all binary or categorical), for example, 1000+ are …
From SPSS to StataDear All, I need some help in converting a couple of SPSS files to Stata 13. Thanks, Dapel …
Convert composite string variable delimited by commas into separate dummy variablesHi, I have observations of building tenants which has a string variable recording the floors they oc…
Subscribe to:
Post Comments (Atom)
0 Response to Form a text string of scalar product of two macros
Post a Comment