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.

# Re: st: dividend programming question

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: dividend programming question Date Sat, 23 Mar 2013 19:29:11 +0000

```#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/
```