Series Creation by Specified Day(s)/Month(s)/Year(s) etc

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

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby px41 » Fri Mar 25, 2011 6:27 am

Hi Good Day everyone,

I have a question concerning data grouping.

If I have daily stacked data in a workfile ( 5 years of daily stock prices across 30 different companies), is there a way to create a series that will give a listing of daily stock prices for the months of March-December (across the 5 years for all companies)? I am also trying to create a series with the daily data across all companies for Monday-Thursday for a similar reason. I have done some searching on the forum and looked though the user guide but I came across frequency conversion, which isn't exactly what I want.

If it helps, my overall aim is to do a simple hypothesis test, to test the mean of a stock's price in a particular month(s) (e.g mean of Jan-Feb price) against the mean of a stock's price in the rest of the months of the year (eg mean of March-Dec price). Needless to say I will need a distribution of prices for the specific months involved so that's why I'm trying to create a series that will list the prices of certain month(s) (and also for weekdays, for my day of the week test) then I can just use that time series to carry out my test.

My alternative is to copy and paste so I was just wondering if there is a function to generate a series based on specified months or days. I know there is a function to generate means by day/month/year etc (thanks again for that Gareth, if you happen to be reading this!)

Thanking you in advance for your valuable help.

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

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby EViews Gareth » Fri Mar 25, 2011 7:56 am

You can create a series that is equal to the sum over companies like this:

Code: Select all

series dum = @sumsby(X, @crossid)
where X is the variable you want to sum over.

Once you have the sums, you can restrict the sample to be just March-December:

Code: Select all

smpl if @month>2
or Mon-Thurs:

Code: Select all

smpl if @day>=1 and @day<=4
(where you'll have to check those numbers are correct).

Once you have the sample set, you can find means etc...

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby px41 » Fri Mar 25, 2011 10:31 am

Hi Gareth, thanks for the reply.

I'm a bit unclear as to the necessity of the sums. Will this sum my data given the crossid (@weekday etc) and variable(series name)? As an eg, are you saying "smpl if @day=1" interprets the data as if there were only mondays (assuming 1=monday) and thus will build graphs and histograms etc for only Monday dates across all firms? If yes, this will be fine!

If not, since I already have means I just need a population of prices to test it against. Thus, let me ask another question, is there a function that can reproduce the daily data for say, the months of Mar-Dec, across all firms and years, in a separate workfile? (ie this will be the population of Mar-Dec prices for all firms over the focal period and I can compare the Jan-Feb mean to this Mar-Dec mean). If this is possible it will also be of great help and will be the solution I'm looking for. Thanks again Gareth.

Regards.

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

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby EViews Gareth » Fri Mar 25, 2011 10:36 am

Ah, I guess I wasn't sure what your original question was. I thought you wanted to sum across all companies.

If you don't want to do that - if you just want to work with certain dates, then yes, all you need to do is set the sample to be the dates you want.

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby px41 » Fri Mar 25, 2011 11:17 am

Oh ok, wonderful...! Sorry for being unclear.
You said I can set up the sample for the dates I want. What if I want a particular month? Say statistics for all months of January across all firms and years? The function are the same as you mentioned?

Here's what I mean:

(Assuming 1=mon, 2=tues, 3=wed, 4=thurs, 5= fri)

Entering the function:
1)"smpl if @day=1"................................will yield statistics for Mondays across all firms (such as means of all mondays, a histogram representing all mondays etc)?
2)"smpl if @day>=1 and @day<=4".............will yield similar statistics for Mon-Thurs across all firms?

Similarly, for months,
Assuming (1=Jan, 2=Feb....12=Dec)

Then entering
3)"smpl if @month=1 and 2"............................will yield statistics for Jan and Feb?
4)"smpl if @month>=1 and @day<=4"..................will yield statistics for Mar-Dec?

Is this correct? I hope yes...!

Thanks again for the advice Gareth.

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

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby EViews Gareth » Fri Mar 25, 2011 11:26 am

Code: Select all

smpl if @month>=3
will lead to statistics for all companies for months March-December.

If you want March to July, it would be:

Code: Select all

smpl if @month>=3 and @month<=7

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby px41 » Fri Mar 25, 2011 11:35 am

Ooooooooooohhhh.....!

I see, I will give it a try as soon as possible.

Thanks very very much!!

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby px41 » Fri Mar 25, 2011 12:55 pm

Hey Gareth, it worked!

Thanks again so much!

I was wondering though, i couldn't figure it out, what's the function to get statistics on the months of Jan-May AND Aug-Dec...given that i'll compare the statistics of those months to statistics of June and July (which should be "smpl if @month>=6 and @month<=7" right?).

Thanking you in advance.

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

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby EViews Gareth » Fri Mar 25, 2011 1:27 pm

Code: Select all

smpl if @month<6 or @month>7

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: Series Creation by Specified Day(s)/Month(s)/Year(s) etc

Postby px41 » Fri Mar 25, 2011 2:30 pm

Thank you!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests