Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: data manipulation problem


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: data manipulation problem
Date   Mon, 28 Feb 2005 12:25:59 -0000

Is this any more complicated than -drop if missing(sid)-?

David

-----Original Message-----
From: Kakatua Kutta [mailto:[email protected]]
Sent: 28 February 2005 05:59
To: [email protected]
Subject: st: data manipulation problem


Dear stata maestros,

I have a following data set

nh pid  sid  age  educ
1    1    2   34    3
1    2    1   29    2
1    3    .   21    2
1    4    .   27    1
2    1    3   44    12
2    2    .   23    9
2    3    1   31    11
2    4    .   19     2
2    5    .   27     3
.
.
.

nh is the household identification no and pid is individual identification within each household. Sid is the spouse identification no for those people who are married within a household. So for nh=1, it means pid 1 and 2 are married to each other and for nh=2, pid 1 and 3 are married to each other.

What I want to do is to make a datasets consisting of household members married to each other. That is, in the new data set I want to keep , for nh=1, pid 1 and 2 and for nh=2, pid 1 and 3. So what I am trying to find that for each nh, take those pid for which sid equals pid from others observations.

Is there anyway to do it rather than going through each observation individually?

Any help would be highly appreciated.

Thanks

AmBush
-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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