Create new series subject to a condition

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

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

Create new series subject to a condition

Postby DBel2012 » Tue Apr 19, 2016 11:26 am

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

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

Re: Create new series subject to a condition

Postby EViews Gareth » Tue Apr 19, 2016 11:37 am

@recode.

Code: Select all

series varx = @recode(vary<200, vary, 0)
Follow us on Twitter @IHSEViews

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

Re: Create new series subject to a condition

Postby DBel2012 » Tue Apr 19, 2016 11:47 am

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

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: Create new series subject to a condition

Postby EViews Glenn » Tue Apr 19, 2016 12:09 pm

Code: Select all

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

Observations where VARX are NA will be dropped from most procedures.

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

Re: Create new series subject to a condition

Postby EViews Gareth » Tue Apr 19, 2016 12:20 pm

If Glenn's solution doesn't do what you want, you'll need to define "dropped".
Follow us on Twitter @IHSEViews

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

Re: Create new series subject to a condition

Postby startz » Tue Apr 19, 2016 1:10 pm

And you can always do

Code: Select all

smpl if vary<200

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

Re: Create new series subject to a condition

Postby DBel2012 » Wed Apr 20, 2016 6:50 am

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


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 35 guests