Page 1 of 1

@elem EV6

Posted: Tue Jul 06, 2010 6:52 am
by terryus
Hi,

I need your help related to @elem in Eviews 6.....

I have a serie X from 1980 to 2008. I wanted to do a FOR loop to extract since
2000 to 2008 values:

For !i = 2000 to 2008
scalar x(!i)=@elem(x, "!i")
Next


But did not work!!! :( , show a error related to string....

Can you help me, I need it really....

thank you very much.

Re: @elem EV6

Posted: Tue Jul 06, 2010 7:23 am
by EViews Gareth

Code: Select all

For !i = 2000 to 2008 %date = @str(!i) scalar x(!i)=@elem(x, %date) Next

Re: @elem EV6

Posted: Tue Jul 06, 2010 7:35 am
by terryus
thanks you gareth......you save me!!!!

Re: @elem EV6

Posted: Fri Mar 04, 2011 4:54 pm
by rowy
Hi Gareth,

This is very helpful. I am a rookie Eviews user. How can I apply this to monthly data?

Thanks!!

Rowena

Re: @elem EV6

Posted: Fri Mar 04, 2011 5:02 pm
by EViews Gareth
What is it you're trying to do?

Re: @elem EV6

Posted: Fri Mar 04, 2011 5:16 pm
by rowy
I am trying to check for zero's in the series, if so, set it to previous month value, else let it be. but the @elem function didn't like my @str(%date).

for !j=2005 to 2010
for !i=1 to 12
%date=@str(!jm!i)

if @elem(price_mpr_sm,%date)=0 then
@elem(price_mpr_sm,%date)=price_mpr_sm(-1)
else
@elem(price_mpr_sm,%date)=price_mpr_sm
endif
next
next

Re: @elem EV6

Posted: Fri Mar 04, 2011 5:19 pm
by EViews Gareth
Can't you just do:

Code: Select all

price_mpr_sm = @recode(price_mpr_sm=0, price_mpr_sm(-1), price_mpr_sm)
without worrying about loops etc...

Re: @elem EV6

Posted: Fri Mar 04, 2011 5:21 pm
by rowy
Fantastic!! Thanks so much!!