Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Fernando Furquim <ffurquim@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: pre and post event coding |
Date | Thu, 12 Dec 2013 10:26:56 -0600 |
Hihn, Could you share some code or data? Remember to -xtset- your data (so that Stata treats it as panel). Then you could use the lag and lead operators (L4 and F4 to lag/lead 4 time periods, for example). Those will lag and lead appropriately accounting for the use of panel data as long as you -xtset- first. Assuming you have a regular old panel dataset, this should be pretty simple, but if your dataset is mixing time periods or something it'd be trickier. Good luck! Fernando On Wed, Dec 11, 2013 at 10:06 PM, Khieu, Hinh <hdkhieu@usi.edu> wrote: > Dear Statalist members, > > I have a panel data of firm years. The events are credit ratings downgrades and upgrades. I want to identify the cash holdings one year before downgrade (or upgrade) and one year after downgrades (or upgrades). One objective is to construct cash holdings after minus cash holdings before the event. Another objective is to calculate cash holdings volatility 4 years before and cash holdings volatility 4 years after an upgrade or downgrade. > > I know how to do that in SAS, but do not know how to code it in Stata. I try the [_n-1] and [_n+1] for cash holdings, but it is not necessarily correct because the code does not wrap around an event. Here my downgrades column has 1's for downgrades and 0's otherwise. My upgrades column has 1's for upgrades and 0's otherwise. > > I'd appreciate any amount of help. > > Thanks, > Hinh > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/