Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, is already up and running.

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

st: RE: combine data by groups

From   "Nick Cox" <>
To   <>
Subject   st: RE: combine data by groups
Date   Wed, 3 Mar 2010 20:06:21 -0000

-collapse- to maxima. 

Advice: Don't flag questions as "easy". 


G. Dai

hi all, this is an easy question,but somehow I can't figure it.
The data is like:
personid     parentsid              momlive                   dadlive
001                   1                      0
001                   2                      .
002                   1                      1
002                   2                        .

where personid and parentsid  are person and her parents' id.
when parentid==1, we only record whether mom still live or not (momliv)
for parentid==2 and dadlive.

I want to change the data set to the following form

personid         momlive                   dadlive
001                  0                              1
002                   1                              1

what is the best way to do this?

*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index