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
Assigning value from one variable to another if condition is metI have a data manipulation question: I have a dataset with the variables "id_1", "year", and "id_2."…
Create graphsDear all, I have a dataset that contains the following string variables: "country" and "countrydest…
Is it possible that log mis-calculates it or create weird ".b" when the workload is too heavy?I use Stata 17 (24 cores). I am sorry that I cannot provide the reproducible example because this p…
Determining level of significance between two median and between two catergorial variables, pre and post treatmentDear Stata community, I was wondering if anybody could help me with the following question. I am tr…
Is it possible that log mis-calculates it or create weird ".b" when the workload is too heavy?I use Stata 17 (24 cores). I am sorry that I cannot provide the reproducible example because this p…
Subscribe to:
Post Comments (Atom)
0 Response to Form a text string of scalar product of two macros
Post a Comment