Using svector elements in graph command

For questions regarding programming in the EViews programming language.

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

jgutman
Posts: 13
Joined: Thu Jan 14, 2010 10:03 am

Using svector elements in graph command

Postby jgutman » Fri Nov 14, 2014 7:35 am

I am trying to use the elements of svectors as arguments in a graph command
For example:

date_start and date_end are svectors, with elements like 30/11/1982 and 19/08/1986

however,
g1.draw(shade, bottom) date_start(1) date_end(1)
does nothing - the graph is unchanged
and, there is no error message
presumably eviews does not recognise these svector elements as the same type as would be usable as an argument to a graph?
thanks in advance for your help

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

Re: Using svector elements in graph command

Postby EViews Gareth » Fri Nov 14, 2014 9:09 am

Probably something like:

Code: Select all

%start = date_start(1) %end = date_end(1) g1.draw(shade, bottom) {%start} {%end}

jgutman
Posts: 13
Joined: Thu Jan 14, 2010 10:03 am

Re: Using svector elements in graph command

Postby jgutman » Fri Nov 14, 2014 10:06 am

I tried similar, but I am told "% start is not a valid string or scalar name"

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

Re: Using svector elements in graph command

Postby EViews Gareth » Fri Nov 14, 2014 10:08 am

Did you use {}

jgutman
Posts: 13
Joined: Thu Jan 14, 2010 10:03 am

Re: Using svector elements in graph command

Postby jgutman » Fri Nov 14, 2014 10:14 am

%start = date_start(2)
%end = date_end(2)
g2.draw(shade, bottom) {%start} {%end}

is what I used

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

Re: Using svector elements in graph command

Postby EViews Gareth » Fri Nov 14, 2014 10:22 am

Works for me:

Code: Select all

create m 1990 2000 series y=nrnd freeze(g2) y.line svector(2) date_start svector(2) date_end date_start = "1994m2" date_end = "1994m12" %start = date_start(2) %end = date_end(2) g2.draw(shade, bottom) {%start} {%end}

jgutman
Posts: 13
Joined: Thu Jan 14, 2010 10:03 am

Re: Using svector elements in graph command

Postby jgutman » Tue Nov 18, 2014 4:36 am

embarrassingly, I had forgotten to freeze my graph :oops:
thanks for your help


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests