How to put in Scalar value in Equation name

For questions regarding programming in the EViews programming language.

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

Kohei
Posts: 7
Joined: Mon Apr 28, 2014 8:13 am

How to put in Scalar value in Equation name

Postby Kohei » Mon Apr 28, 2014 8:29 am

Hi.

I am beginner of programming of eviews :P
I have formed a rolling regression analysis. And then, I want to put the scalar value in equation name as follows.

putting the value of scalar iid0a1 in var0a1a{iid0a1's value}.

I tried as following by programming, but it hasn't warked..

Code: Select all

scalar iid0a1=@imin(ssr0a1) for %n0 iid0a1 scalar sc0a!k=var0a1a{%n0}.@sc next
Sorry for my poor English and programming skill..
Thanks in advance,
Kohei
Last edited by Kohei on Mon Apr 28, 2014 8:39 am, edited 2 times in total.

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

Re: How to put in Scalar value in Equation name

Postby EViews Gareth » Mon Apr 28, 2014 8:37 am

There is nothing wrong with those lines of code, assuming the referenced objects exist. For example, this works fine:

Code: Select all

create u 100 series ssr0a1=nrnd equation var0a1aiid0a1.ls ssr0a1 c !k=2 scalar iid0a1=@imin(ssr0a1) for %n0 iid0a1 scalar sc0a!k=var0a1a{%n0}.@sc next

Kohei
Posts: 7
Joined: Mon Apr 28, 2014 8:13 am

Re: How to put in Scalar value in Equation name

Postby Kohei » Mon Apr 28, 2014 8:53 am

Thanks for your early reply!!

However, I would like to put the value of scalar in equation name and select the equation from a lot of options, var0a1a1 to var0a1a100.

For example, in your code,
If scalar iid0a1's value is 53, then I want determine sc0a2=var0a1a53.@sc

Best Regards,
Kohei

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

Re: How to put in Scalar value in Equation name

Postby EViews Gareth » Mon Apr 28, 2014 9:04 am

Ah.

Code: Select all

create u 100 series ssr0a1=nrnd equation var0a1a53.ls ssr0a1 c !k=2 scalar iid0a1=53 for %n0 iid0a1 scalar sc0a!k=var0a1a{{%n0}}.@sc next

Kohei
Posts: 7
Joined: Mon Apr 28, 2014 8:13 am

Re: How to put in Scalar value in Equation name

Postby Kohei » Mon Apr 28, 2014 6:06 pm

Thanks for your reply!!
In my Eviews 8, your code is working well!

However, I tried following command with your code, It keeps giving me "Syntax Error in control statement in "For %n1a1 iid1a1"" :cry: ..

Code: Select all

create u 513 for !i=1 to 413 smpl @first+!i-1 @first+98+!i series meal=nrnd series soy=nrnd equation b!i.ls meal c soy b!i.makeresid rm!i delete b!i Series rmm!i=rm!i(-1) Series drm!i=d(rm!i) stom(rm!i, vrm!i) vector srm!i=@sort(vrm!i) delete vrm!i rm!i mtos(srm!i, ssrm!i) delete srm!i for !y=1 to 70 for !j=16+!i-1 to 85+!i-1 genr p!ia!y=rmm!i>=@elem(ssrm!i, !j) genr m!ia!y=rmm!i<@elem(ssrm!i,!j) next var var1a!ia!y.ls(noconst) 0 0 drm!i @ rmm!i*p!ia!y rmm!i*m!ia!y scalar ssr1a!ia!y=var1a!ia!y.@ssr(1) var1a!ia!y.qstats(6, name=q1a!ia!y) close var1a!ia!y scalar qq1a!ia!y=q1a!ia!y(6,1) delete q1a!ia!y vector vec1a!ia!y=@vec(var1a!ia!y.@coefmat) scalar c1a!ia!y=vec1a!ia!y(1) scalar d1a!ia!y=vec1a!ia!y(2) If c1a!ia!y<1 and d1a!ia!y<1 and (1+c1a!ia!y)*(1+d1a!ia!y)<1 and qq1a!ia!y<10.645 then ssr1a!ia!y=ssr1a!ia!y else ssr1a!ia!y=100 endif delete c1a!ia!y d1a!ia!y vector(70) ssr1a!i vector ssr1a!i(!y)=ssr1a!ia!y delete ssr1a!ia!y scalar iid1a!i=@imin(ssr1a!i) for %n1a!i iid1a!i scalar sc1a!i=var1a!ia{{%n1a!i}}.@sc next next next
Problem is last part of above code.
Could you help me about this problem?

Best Regards,
Kohei

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

Re: How to put in Scalar value in Equation name

Postby EViews Gareth » Mon Apr 28, 2014 6:47 pm

You can't have a ! variable in the % control variable of the loop.

Kohei
Posts: 7
Joined: Mon Apr 28, 2014 8:13 am

Re: How to put in Scalar value in Equation name

Postby Kohei » Mon Apr 28, 2014 11:16 pm

Ok! Thanks

Kohei


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests