Page 1 of 1

Create new series subject to a condition

Posted: Tue Apr 19, 2016 11:26 am
by DBel2012
Hi,

I'm using EViews9.

I want to create a new series varX based on series varY, and keep only values that are below, say, 200.

How can I do that?

Thanks!

Danny

Re: Create new series subject to a condition

Posted: Tue Apr 19, 2016 11:37 am
by EViews Gareth
@recode.

Code: Select all

series varx = @recode(vary<200, vary, 0)

Re: Create new series subject to a condition

Posted: Tue Apr 19, 2016 11:47 am
by DBel2012
Hi,

series varx = @recode(vary<200, vary, 0) does not do exactly what I wanted.

The observations must be dropped if the condition is not met.

Thanks!

Danny

Re: Create new series subject to a condition

Posted: Tue Apr 19, 2016 12:09 pm
by EViews Glenn

Code: Select all

series varx = @recode(vary<200, vary, NA)
Observations where VARX are NA will be dropped from most procedures.

Re: Create new series subject to a condition

Posted: Tue Apr 19, 2016 12:20 pm
by EViews Gareth
If Glenn's solution doesn't do what you want, you'll need to define "dropped".

Re: Create new series subject to a condition

Posted: Tue Apr 19, 2016 1:10 pm
by startz
And you can always do

Code: Select all

smpl if vary<200

Re: Create new series subject to a condition

Posted: Wed Apr 20, 2016 6:50 am
by DBel2012
Good morning,

Thanks to you all.

Both, smpl if vary<200, and series varx = @recode(vary<200, vary, NA) will be useful for what I need to do.

Thanks again for your time.

Danny