generate trend between two date

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

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

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend between two date

Postby ch2324 » Wed Feb 24, 2016 1:33 pm

this code generate trend for period 1990m1 1997m6 (trend take 0 1 2 3.....89), but from 2000m1 2002m12 it take this value 120 121 122.....155.
i would like this:
from 1990m1 1997m6 take 1 2 3 4....
from 2000m1 2002m12 take 1 2 3 4....
other period take 0

Code: Select all

series t = @recode(@during("1990m1 1997m6") or @during("2000m1 2002m12"), @trend, 0)
the second code generate trend like this 0 0 2 0 4....i would like this
from 1990m1 1990m12 take 1 2 3 ... 12
from 1991m1 1991m12 take 0
from 1992m1 1992m12 take 1 2 3 ...12
from 1993m1 1993m12 take 0
and so on

Code: Select all

series t = @recode(@mod(@trend,2)=0, @trend, 0)
can you help me. :oops:
Attachments
2nd_code.png
2nd_code.png (20.12 KiB) Viewed 6812 times
1st_code.png
1st_code.png (15.54 KiB) Viewed 6812 times

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

Re: generate trend between two date

Postby EViews Gareth » Wed Feb 24, 2016 1:59 pm

Just subtract off numbers, or divide by 2.

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend between two date

Postby ch2324 » Wed Feb 24, 2016 2:26 pm

1st code:
when i substruct 119
from period "1990m1 1997m6" trend will be this -119 -118 -197....-30.
from period "2000m1 2002m12" the code work. trend take 1 2 3....36.

Code: Select all

series t = @recode(@during("1990m1 1997m6") or @during("2000m1 2002m12"), @trend-119, 0)
but if i use this code

Code: Select all

series t = @recode(@during("1990m1 1997m6") or @during("2000m1 2002m12"), @trend, 0)
from period "1990m1 1997m6" the trend will be this 0 1 2 3....89.
from period "2000m1 2002m12"the trend will be this 120 121....155.
i need this:
from 1990m1 1997m6 take 1 2 3 4....
from 1997m7 1999m12 take 0
from 2000m1 2002m12 take 1 2 3 4....
and all other period take 0

2nd code:
if i divided by 2
the first year will be this: 1st month take 0, second take 0, 3rd take 1, 4th take 0, 2, 0, 3, 0, 4, 0, 5.....and so on

Code: Select all

series t = @recode(@mod(@trend,2)=0, @trend/2, 0)
i need this:
1st year: 1990m1 1990m12 take 1 2 3 ... 12
2nd year: 1991m1 1991m12 take 0
3rd year: 1992m1 1992m12 take 1 2 3 ...12
4th year: 1993m1 1993m12 take 0
and so on

i hope that you understand me
could you help me please.

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

Re: generate trend between two date

Postby EViews Gareth » Wed Feb 24, 2016 2:47 pm

I'm sure you can figure something out.

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend between two date

Postby ch2324 » Thu Feb 25, 2016 3:59 am

1st code:

Code: Select all

series t = @recode(@during("1990m1 1997m6") or @during("2000m1 2002m12"), @trend+1, 0) smpl 2000m1 2002m12 series t=t-120 smpl @all
in my simple case i can use smpl no problem, but suppose if i have multi period to make trend i will always make smpl date1 date2, seriest=t-a.
2nd code:

Code: Select all

series t = @recode(@mod(@trend,2)=0, @trend, 0)
the new code i have change @trend by @year because i have monthly data.

Code: Select all

series t = @recode(@mod(@year,2)=0, @trend+1, 0)
but here
1st year take value from 1 to 12, 2nd year take value 0, 3rd year take value from 25 to 36 (it should take value from 1 to 12), 4th year take 0 (and 5th year sould take value from 1 to 12) and so on.
i need this: year (1990 1992 1994 1996....) take trend from 1 to 12 for every year, and year (1991 1993 1995....) take 0. even and odd
i will use smpl date1 date2 for every year to make trend.
have you an idea about the 1st and 2nd code.
Attachments
even & odd.png
even & odd.png (34.59 KiB) Viewed 6768 times

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend between two date

Postby ch2324 » Thu Feb 25, 2016 9:00 am

you understood me Mr Gareth.
I would highly appreciate if you could help me! :oops:

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

Re: generate trend between two date

Postby EViews Gareth » Thu Feb 25, 2016 10:05 am

Code: Select all

series t = @recode(@during("1990m1 1997m6"), @trend+1, 0) t = @recode(@during("2001m1, 2002m12"), @trend-120, t)

Code: Select all

series t = @recode(@mod(@year,2)=0, @month, 0)

ch2324
Posts: 133
Joined: Fri May 10, 2013 10:52 am

Re: generate trend between two date

Postby ch2324 » Thu Feb 25, 2016 11:42 am

thanks alot! Mr Gareth, Your help was very useful. :D
i'm really enjoyed! with this software. :)


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 1 guest