@elem EV6

For questions regarding programming in the EViews programming language.

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

terryus
Posts: 15
Joined: Sat Mar 06, 2010 12:40 pm

@elem EV6

Postby terryus » Tue Jul 06, 2010 6:52 am

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.

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

Re: @elem EV6

Postby EViews Gareth » Tue Jul 06, 2010 7:23 am

Code: Select all

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

terryus
Posts: 15
Joined: Sat Mar 06, 2010 12:40 pm

Re: @elem EV6

Postby terryus » Tue Jul 06, 2010 7:35 am

thanks you gareth......you save me!!!!

rowy
Posts: 18
Joined: Fri Mar 04, 2011 4:34 pm

Re: @elem EV6

Postby rowy » Fri Mar 04, 2011 4:54 pm

Hi Gareth,

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

Thanks!!

Rowena

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

Re: @elem EV6

Postby EViews Gareth » Fri Mar 04, 2011 5:02 pm

What is it you're trying to do?

rowy
Posts: 18
Joined: Fri Mar 04, 2011 4:34 pm

Re: @elem EV6

Postby rowy » Fri Mar 04, 2011 5:16 pm

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

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

Re: @elem EV6

Postby EViews Gareth » Fri Mar 04, 2011 5:19 pm

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...

rowy
Posts: 18
Joined: Fri Mar 04, 2011 4:34 pm

Re: @elem EV6

Postby rowy » Fri Mar 04, 2011 5:21 pm

Fantastic!! Thanks so much!!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests