Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How to generate a dummy variable based on groups of variables in t-1

From   "Jean-Marie Meier" <>
Subject   st: How to generate a dummy variable based on groups of variables in t-1
Date   Sat, 30 Apr 2011 11:50:11 +0200 (CEST)

Dear Stata list,

It would be great if anyone could help me with this issue as I spent hours on it without solving it:

I have a dataset with all companys listed on US stock exchanges from 1979 up to now.
Every observation in my dataset are balance sheet and profit & loss account data for a given firm in a given year.

I have a dummy variable, which is 1 for an observation if a firm was taken over and left the dataset - e.g. firm ABC was taken over in 1985, then for all observations up to 1984 for this firm the dummy variable is 0 and for the observation in 1985 the dummy variable is 1. If a firm was not taken over, than the dummy variable is obviously always 0.

All firms/observations in my dataset are assigned an industry code between 1 and 48 (Fama French industry classification).

My problem now is:

How do I generate a dummy variable which is 1 for a given firm x and year t if there was a takeover in t-1 in the same industry (same industry code) and which is 0 otherwise ?

Looking forward to your answers

Kind regards,

Jean-Marie Meier
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index