generate date

For questions regarding programming in the EViews programming language.

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

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

generate date

Postby metrix » Thu May 04, 2017 11:32 am

I ask this question because EViews can not suport this frequency by four month.
1/i have workfile with two page with monthly frequency 1998m01 2010m12 (156 obs), and undated (156/4)=39 obs, how can generate date by every four month in the page unstructured (30/04/1998, 31/08/1998,....), or by simple question how can moved the the undated page to import just this date and make the mean of my series salaries by every 4 month.

30/04/1998
31/08/1998
31/12/1998
30/04/1999
31/08/1999
31/12/1999
....
31/12/2010
2/ it is possibale the generate date weeks in undated page: 02/01/1998, 09/01/1998, 16/01/1998,....
3/I have no seen in all software a frequency "by four month (1/3)" it's possible to include a new frequency by every fourth month (One third of the year 1/3) with function @thirdly, it is very nice to analyse some data economics with several frequency.
Thank you for what you realize for us.

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

Re: generate date

Postby EViews Gareth » Thu May 04, 2017 11:45 am

1) On the monthly page create a series equal to @floor(@trend/4). On the undated page create a series equal to @trend. Then do a general match merge based on those series.

2) Something like:

Code: Select all

smpl @first @first
series weeks = @dateval("02/01/1998")
smpl @first+1 @last
weeks = @dateadd(weeks(-1), 1,"w")
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Thu May 04, 2017 1:08 pm

1/ perfect thanks! :D
2/ for weeks ok!, but for month i get this: 30/08/1998, 30/12/1998, Aug and Dec have 31 days not 30
smpl @first @first
series months = @dateval("30/04/1998")
smpl @first+1 @last
months = @dateadd(months(-1), 4,"m")

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Thu May 04, 2017 2:08 pm

When i do a general match merge, my series date will be like this in page undated: 1998-02-15 00:00, 1998-06-16 00:00, 1998-10-16 12:00, 1999-02-15 00:00.... but i need this:

30/04/1998
31/08/1998
31/12/1998
30/04/1999
....
31/12/2010

or 1998m04, 1998m08, 1998m12....

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

Re: generate date

Postby EViews Gareth » Thu May 04, 2017 2:16 pm

metrix wrote:1/ perfect thanks! :D
2/ for weeks ok!, but for month i get this: 30/08/1998, 30/12/1998, Aug and Dec have 31 days not 30
smpl @first @first
series months = @dateval("30/04/1998")
smpl @first+1 @last
months = @dateadd(months(-1), 4,"m")



So?
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Thu May 04, 2017 2:31 pm

i get this with the code: 30/08/1998, 30/12/1998...., Aug and Dec have 31 days not 30. :mrgreen:
how can modifiend this.

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

Re: generate date

Postby EViews Gareth » Thu May 04, 2017 2:35 pm

You told EViews to add a month to a date. The 30th of July plus a month is the 30th of August.

The 15th of a month plus a month is the 15th of the next month, whether or not the months have 30 days or 31 days.
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Thu May 04, 2017 2:39 pm

Emmm :roll: , how can import just the last date by four month from my page frequency monthly.

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

Re: generate date

Postby EViews Gareth » Thu May 04, 2017 2:59 pm

You can find the date of the last day of the current month by adding a month (using @dateadd), getting the date floor (@datefloor) to give you the first date of the next month, then subtracting one.
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Fri May 05, 2017 1:36 am

i have use this: but i get not the date
series f=@date<=@datefloor(@date,"m")+1 or @dateadd(@datefloor(@date,"m"),3,"m")

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

Re: generate date

Postby EViews Gareth » Fri May 05, 2017 6:36 am

What's the inequality for?
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Fri May 05, 2017 7:18 am

if i use series f=@datefloor(@date,"m") it generate all date, inequality is to use just the 1998m04 1998m08 1998m12... in the series, I don't know how.

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Fri May 05, 2017 9:35 am

How can solve my case? by @dateadd and @datefloor

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: generate date

Postby metrix » Fri May 05, 2017 11:14 am

i have use this Mr Gareth:

Code: Select all

series f=@dateadd(@datefloor(@date,"m"),3,"m")

could you help me.

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

Re: generate date

Postby EViews Gareth » Fri May 05, 2017 11:20 am

Help you with what?
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: Bob and 52 guests