Looping with IF function

For questions regarding programming in the EViews programming language.

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

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Looping with IF function

Postby rmoralesaramburu » Tue Nov 19, 2013 9:11 am

Hello,

I have the following problem. I have more than 45 series and I would like to program the following:

For %y 1-45 '(I don't know if that's possible)
IF nameseries_{%y}>=0.50 then
'count observations before founding >=0.50 condition and put it on a scalar.
else
'nothing
next


So, I don't know how to program it, but I hope you could understand what I am trying to do.

Thank you!!!!

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

Re: Looping with IF function

Postby EViews Gareth » Tue Nov 19, 2013 9:14 am

I hope you could understand what I am trying to do.
Unfortunately not.

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Looping with IF function

Postby rmoralesaramburu » Tue Nov 19, 2013 9:32 am

Thanks, I figure it out with this:

Code: Select all

matrix(47,1) months_to_hike for !i = 1 to 47 smpl if fwd2013_!i<=0.5 matrix months_to_hike(!i,1)=@obs( fwd2013_!i) next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests