Creating new variable from coefficients

#1
Hi

I'm new to stata so just bear with me.

I'm doing a VAR using inflation as my dependent variable and exchange rate as an independent variable (amongst others). I would like to create a new variable from the coefficient on "exchange rate" so that I can run a seperate regression with it.

I found an online example here:

regress lncost lnq lnpk lnpl
gen lncosthat=_b[lnq]*lnq+_b[lnpk]*lnpk+_b[lnpl]*lnpl

After I replaced the variables mentioned above, I am unsure how to rewrite this for VAR as I get the following error message:

"unknown function _b()"


Many thanks in advance!
 
#3
Thanks very much for the quick reply, there was an issue with the brackets however when I used the square brackets it still didn't seem to work.


How would it be possible to construct a variable from the coefficients?

so far I've only found the following syntax under the help file

"predict double resid, residuals"