Page 1 of 1
How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 8:29 am
by Kohei
Hi.
I am beginner of programming of eviews
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
Re: How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 8:37 am
by EViews Gareth
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
Re: How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 8:53 am
by Kohei
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
Re: How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 9:04 am
by EViews Gareth
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
Re: How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 6:06 pm
by Kohei
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""

..
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
Re: How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 6:47 pm
by EViews Gareth
You can't have a ! variable in the % control variable of the loop.
Re: How to put in Scalar value in Equation name
Posted: Mon Apr 28, 2014 11:16 pm
by Kohei
Ok! Thanks
Kohei