Page 1 of 1

how to get the variable list like in the equations spec

Posted: Tue Jul 01, 2014 8:04 pm
by ginanjar
hi all,

I want to get this result

eq_m.@method name
LOG(M) LOG(Y) LOG(E) EC_M

but
eq_m.@varlist
only give me this
LOG(M) Y E EC_M

this my spec and substituted equations

eq_m.@spec
LOG(M)=C_M(1)*LOG(Y)+C_M(2)*LOG(E)+C_M(3) +EC_M

eq_m.@subst
LOG(M)=2.31873071534*LOG(Y)-1.92167062414*LOG(E)+7.28343455044 +EC_M

eq_m.@coeflist
C_M(1) C_M(2) C_M(3)

My final target is to transform
LOG(M)=2.31873071534*LOG(Y)-1.92167062414*LOG(E)+7.28343455044 +EC_M

into
EC_M=LOG(M)=2.31873071534*LOG(Y)-1.92167062414*LOG(E)+7.28343455044

Is there any alternative function for the varlist, so I don't have to do it the hard way

Thank you very much.

regards,
ginanjar

Re: how to get the variable list like in the equations spec

Posted: Wed Jul 02, 2014 7:28 am
by EViews Gareth
There is not.

Re: how to get the variable list like in the equations spec

Posted: Wed Jul 02, 2014 5:30 pm
by ginanjar
Hi Gareth,

I just changed my approach rather fighting the tools, so
the equation spec is now just
equation eq_m.ls(p) log(m) c log(y) log(e)
by removing ec_m term because it will throw error, but now I learn how to use addfactor

thanks,
ginanjar

Code: Select all

subroutine transform_ecm_from(string %eq_name, string %mod_name, string %ecm_series) %ecm = "" %varlist = {%eq_name}.@varlist !ncoef = {%eq_name}.@ncoef %ecm = %ecm_series %ecm = %ecm + " = " + @wleft(%varlist,1) + " - (" %ecm = %ecm + @str({%eq_name}.@coefs(1)) for !i=2 to (!ncoef) %ecm = %ecm + " + " + @str({%eq_name}.@coefs(!i)) + "*" + @word(%varlist,1+!i) next %ecm = %ecm + ")" {%mod_name}.append {%ecm} endsub