Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
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?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?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/