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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: dividend programming question |

Date |
Sat, 23 Mar 2013 19:57:05 +0000 |

As said, do look at the -help- for -fillin-. It will help with your gaps. Also, I am signing off for today. Nick On Sat, Mar 23, 2013 at 7:51 PM, Khieu, Hinh <Hdkhieu@usi.edu> wrote: > Nick, > > Thanks so much for your prompt help. > > Here's what I meant for question #2: Let's say I have firm A and firm B below. I want to create a binary variable called Omission. Firm B has dots, but Firm A do not have any records for div paid from 1997-2001. > FirmA Div paid Omission > 1995 .10 0 > 1996 .10 1 > 2002 .15 0 > 2003 .15 0 > 2004 .15 0 > 2005 .10 0 > 2006 .10 0 > 2007 .10 0 > 2008 .10 0 > 2009 .12 0 > 2010 .12 0 > 2011 .12 0 > 2012 .15 0 > FirmB Div paid Omission > 1995 .10 0 > 1996 .10 0 > 1997 . 1 > 1998 . 1 > 1999 . 1 > 2000 . 1 > 2001 . 1 > 2002 .15 0 > 2003 .15 0 > 2004 .15 0 > 2005 .10 0 > 2006 .10 0 > 2007 .10 0 > 2008 .10 0 > 2009 .12 0 > 2010 .12 0 > 2011 .12 0 > 2012 .15 0 > > Again, I really appreciate any help here. > > Regards, > Hinh > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: Saturday, March 23, 2013 2:29 PM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: dividend programming question > > #1. Given > > firmid year dividend > > the first year when -dividend- > 0 is > > egen yearfirstpaid = min(year / (dividend > 0)), by(firmid) > > and so an indicator for first year is > > gen wasfirst = year == yearfirstpaid > > #2. Not clear to me. You seem to be saying both that you do and do not have observations for certain years. Please review Stata terminology: > > an observation is a record, case, or row (and _not_ a value) > > a value is the value of a variable > > missing values are present in the data, but missing > > If observations are not present in the data, they are (in my view) better called "omitted" or "not present". > > See -help fillin- as a first step. > > Nick > > On Sat, Mar 23, 2013 at 6:45 PM, Khieu, Hinh <Hdkhieu@usi.edu> wrote: > >> I have an unbalanced time series data: firm ID, year, and annual >> dividend amount. I want to create 2 binary variables >> >> >> >> 1/ indicating when firm A pays dividends for the first time. Firms >> may enter the dataset and pay div for the first time right at the >> first data entry (example: firm A first appears in data 1990 and pays >> div in 1990, and the variable should be 1 for 1990 and zero for other >> years. Firms may enter the data set and do not pay any div until 5 >> years later (example: first appear in data 1990 and pay div in 1995, >> and dummy should be 1 for 1995 and zero for other years.) What makes >> it complicated is that firms may skip paying div for some years and >> come back starting to pay div again. The same binary variable should >> be 1 if the firm does not pay div for 5 years and starts repaying div >> in year 6 (example: first appear in data 1990 and pay div in 1995, and >> dummy should be 1 for 1995 and firm does not pay any div in years 1996 >> through 2001 and starts paying div in 2002, dummy should be zero for >> 1996-2001 and 1 for 2002 and zero for other years.) >> >> >> >> 2/ the second dummy captures the omission of dividends above. If firm A pays div in 1995-1996, stops paying from 1997-2001, and pays again 2002 to 2013, dummy should be zero for 1995-1996, one for 1997-2001, and zero again 2002-2013. The problem is that sometimes observations for 1997-2001 are just dots, sometimes the observations are like this (year 1997-2001 are not there): >> >> FirmA Div paid >> >> 1995 .10 >> >> 1996 .10 >> >> 2002 .15 >> >> 2003 .15 >> >> 2004 .15 >> >> 2005 .10 >> >> 2006 .10 >> >> 2007 .10 >> >> 2008 .10 >> >> 2009 .12 >> >> 2010 .12 >> >> 2011 .12 >> >> 2012 .15 >> >> >> >> In this case, I want the omission dummy to be 1 in year 1996. > > * > * 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/ * * 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/

**Follow-Ups**:**Re: st: dividend programming question***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: dividend programming question***From:*"Khieu, Hinh" <Hdkhieu@usi.edu>

**References**:**st: dividend programming question***From:*"Khieu, Hinh" <Hdkhieu@usi.edu>

**Re: st: dividend programming question***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: dividend programming question***From:*"Khieu, Hinh" <Hdkhieu@usi.edu>

- Prev by Date:
**RE: st: dividend programming question** - Next by Date:
**RE: st: dividend programming question** - Previous by thread:
**RE: st: dividend programming question** - Next by thread:
**RE: st: dividend programming question** - Index(es):