Divide one series into two

For questions regarding programming in the EViews programming language.

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

HJ123
Posts: 3
Joined: Sat Oct 08, 2016 9:17 am

Divide one series into two

Postby HJ123 » Sat Oct 08, 2016 10:15 am

Hi,

I have a time series with positive and negative values which I want to divide into two sperate ones. I want to generate one series with only all positive values (and all negative values being 0) and the other series to be only all negative values (all positive values being 0).

For example:
1. 1
2. -2
3. 4
4. -3

1. 1
2. 0
3. 4
4. 0

1. 0
2. -2
3. 0
4. -3

I tried and I failed miserably.

Thanks for the help!

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

Re: Divide one series into two

Postby EViews Gareth » Sat Oct 08, 2016 10:42 am

Series y = @recode(x>0,x,0)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests