Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: tscollap - converting monthly data to annual averages


From   David Ashcraft <ashcraftd@rocketmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: tscollap - converting monthly data to annual averages
Date   Thu, 26 Jul 2012 23:43:06 -0700 (PDT)

Nick: I got my mistake. I have the following code for collapse now:

gen dm = yofd(date2)
format dm %ty
collapse rp rm, by(dm)

It has collapsed the data. However, as mentioned previously, It should collapse by year and by firm. At the moment, it is collapse only by year. Please help. 
Regards


David


----- Original Message -----
From: Jan S <jan.schoeps@hotmail.com>
To: statalist@hsphsun2.harvard.edu
Cc: 
Sent: Thursday, July 26, 2012 5:13:39 PM
Subject: RE: st: tscollap - converting monthly data to annual averages

Out of curiosity: how do you want to map monthly returns to annual returns with collapsing the sheet? As a side note: You may want to consider calculating annual returns for each month. That would give you the advantage of keeping your other data and analyze e.g. the possibility of a January-effect later on.



> From: njcoxstata@gmail.com
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: tscollap - converting monthly data to annual averages
> Date: Thu, 26 Jul 2012 15:02:34 +0100
> 
> -mofd()- doesn't map monthly to annual dates. See -help dates and  
> times-.
> 
> Nick
> 
> On 26 Jul 2012, at 14:07, David Ashcraft <ashcraftd@rocketmail.com>  
> wrote:
> 
> > I did manage to collapse the data from monthly to annual  but in the  
> > process lost individual firms. I have used the following commands
> >
> > gen dm = mofd(date1)
> > format dm %ty
> > collapse rp rm, by(dm)
> >
> > Lets rephrase my question: I want to collapse the panel data by each  
> > individual firms. What is the best procedure for me.
> > Regards
> >
> > David
> >
> >
> > ----- Original Message -----
> > From: David Ashcraft <ashcraftd@rocketmail.com>
> > To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
> > Cc:
> > Sent: Thursday, July 26, 2012 3:48:49 PM
> > Subject: Re: st: tscollap - converting monthly data to annual averages
> >
> > I got it done.
> > Thanks
> >
> >
> > ----- Original Message -----
> > From: David Ashcraft <ashcraftd@rocketmail.com>
> > To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
> > Cc:
> > Sent: Thursday, July 26, 2012 3:43:09 PM
> > Subject: st: tscollap - converting monthly data to annual averages
> >
> > I am trying to convert the monthly return of 29 firms into annual  
> > means from Jan2000 to May2012. I have tried to use the tscollap  
> > command. I get the following results:
> >
> > tscollap rp rm, to(y)
> >
> > Converting from M to Y
> >
> > unknown egen function filter()
> > r(133);
> >
> > I just have downloaded the tscollap, It should be most updated. Even  
> > if it worked, I don'e know whether tscollap will take care of  
> > individual firms identified by id
> >
> > Alternatively, I can use collapse command, however collaps does not  
> > take into consideration the time. I have looked into several posts  
> > but could not find a reasonable solution in my particular case.
> *
> *   For searches and help try:
> *  http://www.stata.com/help.cgi?search
> *  http://www.stata.com/support/statalist/faq
> *  http://www.ats.ucla.edu/stat/stata/
                          
*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index