how to get the variable list like in the equations spec

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ginanjar
Posts: 14
Joined: Tue Apr 01, 2014 5:19 am

how to get the variable list like in the equations spec

Postby ginanjar » Tue Jul 01, 2014 8:04 pm

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Wed Jul 02, 2014 7:28 am

There is not.

ginanjar
Posts: 14
Joined: Tue Apr 01, 2014 5:19 am

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

Postby ginanjar » Wed Jul 02, 2014 5:30 pm

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest