[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: multiple observations

From   "Nick Cox" <>
To   <>
Subject   RE: st: multiple observations
Date   Thu, 11 Sep 2008 14:25:13 +0100

In general -egen, tag()- is not appropriate and would give incorrect
answers here. 

-egen, tag()- tags just one of a group of duplicated observations. Then
if you had a series of observations identical on x y you might want to
tag just one as otherwise a -scatter- graph file containing the same
information on x and y would be bloated to no purpose. 

In this problem you do not regard observations in a panel as duplicated.
Rather you regard the last observation as special, a quite separate

-egen, tag()- would give you exactly the right answer if and only if
each panel occurred just once. Otherwise it makes no claims at all to
tag the _last_ observation in each panel and in fact that it is not what
it does: it tags the first in the (current) sort order (although you
should not care, as they are the same). 


fjc fjc

Check help egen tag

On Mon, Sep 8, 2008 at 7:05 AM, Diddy Antai <> wrote:

>     Could you help me with the command that creates a new
> variable "newid" that is 1 for the last observation for each
> individual and missing otherwise.
> I have a dataset with multiple observations (mothers), and I want to
> create a variable with each mother appearing once irrespective of the
> number of children she has.

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index