Replace in eviews?

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

Megalodn
Posts: 5
Joined: Fri Nov 18, 2016 2:38 am

Replace in eviews?

Postby Megalodn » Thu Dec 01, 2016 2:29 am

Hi,
I am rather new to eviews and have a simple question.
I have a time-series full of ones and want to replace the ones to 2 if condition x is met and 3 if condition y is met and so on....
So in the end for each value in time I want to have 1, 2,3 ... depending on the specified condition.
Basically, I want a replace if function.

What I have so far is the following:

Code: Select all

series Original=1
Series Original = @Recode(X>1,2,1)
Series Original = @Recode(X>2,3,1)


My problem here is the 1 near the end of the bracket. If the condition returns false recodes returns the 1 but I want the value untouched if the condition returns false, i.e. return the value that has been previously there. For example, if the value is 2 and X=1.5 I want that the code returns a 2 instead of a 1.

Basically im looking for something like this:

Code: Select all

Series Original = @Recode(X>1,2,"previous value, i.e. do nothing")



How do I dothat in Eviews?

Best regards,

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

Re: Replace in eviews?

Postby EViews Gareth » Thu Dec 01, 2016 3:42 am

Code: Select all

series original = @recode(x>1,2,original)
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 46 guests