Replacing values after a specified date

For questions regarding programming in the EViews programming language.

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

acraigpgpf
Posts: 8
Joined: Mon Jan 09, 2012 8:53 am

Replacing values after a specified date

Postby acraigpgpf » Mon Jan 09, 2012 9:02 am

I'm brand new to programming. I am trying to replace values after a certain date in an annual dataset.

for !i = 2010 to 2085

if !i>= 2022 then altdocfix =5555
endif

next

Rather than replacing values after 2021 with 5555, this loop replaces ALL values. Any suggestion?

ac

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: Replacing values after a specified date

Postby startz » Mon Jan 09, 2012 9:22 am

You want to use the smpl statement, not if.

Code: Select all

smpl 2022 @last altdocfix =5555 smpl @all

acraigpgpf
Posts: 8
Joined: Mon Jan 09, 2012 8:53 am

Re: Replacing values after a specified date

Postby acraigpgpf » Mon Jan 09, 2012 9:41 am

Thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests