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 at the end of May, 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   Fri, 27 Jul 2012 05:10:43 -0700 (PDT)

It worked out. In the last line, I just changed -collapse rp rm, by (id dm)-. I have to check to numbers otherwise, it seems fine now. 
Regards

David


----- Original Message -----
From: Nick Cox <njcoxstata@gmail.com>
To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Cc: 
Sent: Friday, July 27, 2012 2:10:36 PM
Subject: Re: st: tscollap - converting monthly data to annual averages

Presumably you should add your firm identifier variable to the -by()-  
option of -collapse-.

  Nick

On 27 Jul 2012, at 07:43, David Ashcraft <ashcraftd@rocketmail.com>  
wrote:

> 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
>>
>>
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
*
*   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