Extending a value across a group of observations ------------------------------------------------
^enlarge^ variable, ^by(^grouping variables^)^
Description -----------
^enlarge^ is used to spread a value of the variable across all observations in the specified groups, if this value occurs only once in these groups.
I.e., the data are transformed as follows:
(sorted by: group)
value group value group . 1 5 1 5 1 5 1 . 1 5 1 . 1 5 1 . 2 => 3 2 . 2 3 2 3 2 3 2 . 3 . 3 2 4 2 4 . 4 2 4
During the transformation, ^enlarge^ would issue a warning stating that "there are groups with no observations on value". It does not tolerate several observations within a group, however (though it does not check whether they coincide, either).
Extensions to string variable and multiple non-missing observations can be done upon request. I am not interested at the moment :).
Options -------
^by^ specifies the identifiers of the group to extend the value to. This is a required option!
Examples --------
Suppose we have a panel data set on several countries, but area is reported only once for each country.
. ^enlarge area, by(country)^
We suppose that area of the country does not change during the period of observation. I.e. the data set should not go back to the 18th century :).
Author ------
Stas Kolenikov, skolenik@@[ recep.glasnet.ru | nes.cemi.rssi.ru | yahoo.com ]