## trading day variables

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

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

### trading day variables

Hi,
1/I have data monthly from 2000m01 2015m12, my probleme is to create some series contained numbers of day, weeks, or nombers of weekday (Mondays, Tuesdays,..., Sundays) in month or in quarterly, and make the sum by row or by function for my seris "x_07" with the following code: (the code doesn't work correctly for the some parts )

Code: Select all

`' part 1 tradefor !i=1 to 7series d_0!i=@weekday(!i)nextgroup g1 d*equation eq_trade.ls y c g1series x_07=@sum({d_0!i})   'sum  of d_* by row'part 2 model01 for !j=1 to 6series x_0!j=d_0!i-x_07nextgroup g2 x*equation eq_model01a.ls y c g2'tpart 3 model01 regular diff equation eq_model01d.ls d(y)  d(g2)'part 4 model02 with regular and seasonal diffequation eq_model02ds.ls d(y,1,12)  d(g2,1,12)' part 5 model03: ma(1)equation eq_model03dsma.ls d(y,1,12)  d(g2,1,12) ma(1)' part 6 model04: ma(1) and sma(12)equation eq_model03dsmas.ls d(y,1,12)  d(g2,1,12) ma(1) sma(12)' part 7 final modelequation eq_model05dsmas.ls d(y,1,12)  d(g2,1,12) ar( 1 to 2) ma(1) sma(12)`

the series d_01 should contained:
2000m01 5
2000m02 4
....etc
5 and 4 represent the number of Mondays for each month, d_02 contained numbers of Tuesdays for each month,...etc.
how can make the sum of the series by row or by function date "x_07" of d_01+...+d_07.

2/ In general case when frequency is monthly or quarterly by functions:
how can genarate series contained the number of days in month or in quarterly by function not by @sum?
how can genarate series contained number of Mondays, Tuesdays,..., Sundays in a month or in quarterly by function (not d01+d_02...+d_07)?
how can genarate series contained number of weeks in month or in quarterly?

any help would be appreciated

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

### Re: trading day variables

@daycount

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

### Re: trading day variables

Aha,
1/ my loop doesn't work:

Code: Select all

`for !i=1 to 7series d0!i=@daycount("!i")next`

2/ how can from the group g2 make two groups, the frist contain first diff, the second contain first diff+ seasonal diff "d(x,1,12)", i have make this but doesn't work:

Code: Select all

`group dg2group dsg2for !k=1 to x0!j.@count      dg2.add d(g2(!k))      dsg2.add d(g2(!k),1,12)next`

goup g2 containd this:

Code: Select all

`series x07=@daycount  for !j=1 to 6series x0!j=d0!i-d07nextgroup g2 x*equation eq_model01a.ls y c g2`

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

### Re: trading day variables

I think many of your questions would become easier if you took the time to read up on how to program in EViews. Chapter 6 of the Command and Programming reference is a good place to start.

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

### Re: trading day variables

in first: for group i have solved.
secondly: i'm not sure to solve this three loops: i have use %m=str(!i)
1st loop

Code: Select all

`for !i=1 to 7series d0!i=@daycount("!i")next`

2rd loop

Code: Select all

`series x07=@daycount  for !j=1 to 6series x0!j=d0!i-d07next`

3nd loop

Code: Select all

`for !m=1 to 3for !n=5 to 7series d0!m=@daycount("!m !n")nextnext`

finaly: Probably i'm stupid to ask easy questions,i'm used to this software, i make a great effort to read some books theoretical in econometrics especially in english, however in programming i'm a beginner. Maybe i would become a great programmer.

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

### Re: trading day variables

The only way to become a great programmer is to keep trying and looking stuff up and figuring out stuff

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

### Re: trading day variables

thanks anyways .

Return to “General Information and Tips and Tricks”

### Who is online

Users browsing this forum: No registered users and 2 guests