Page 1 of 1

Naming Variables in Loop

Posted: Mon Nov 17, 2008 3:13 pm
by cmgconsulting
How can I name an equation after a value in an alpha variable instead of e1, e2, e3... see program below:

spool myspool
for !i=1 to 134
smpl if @crossid = !i
equation e{!i}
e{!i}.ls ssu c price acv items promoacv promounits @trend(1) @expand(period,@dropfirst) easter
myspool.append e{!i}.stats
next

I would like my regressions to be named after the first value in a variable named "COT" instead of e1, e2, e3...

Re: Naming Variables in Loop

Posted: Mon Nov 17, 2008 4:00 pm
by EViews Gareth
Here you go:

Code: Select all

spool myspool series obsnum = @obsnum for !i=1 to 134 smpl if @crossid = !i %cxname = alpha(@min(obsnum)) %eqname = "e_" + %cxname equation {%eqname}.ls ssu c price acv items promoacv promounits @trend(1) @expand(period,@dropfirst) easter myspool.append {%eqname}.stats next
Where ALPHA is the name of the alpha series.