Date: Tue, 30 Mar 1999 19:33:10 -0500
Reply-To: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject: Re: slecting one child from a household
Content-type: text/plain; charset=iso-8859-1
Hi Stephan!
This will select one child (at random) from each hh#:
USE ALL.
compute rv=uniform(1).
RANK
VARIABLES=rv (A) BY hh# /RANK /PRINT=NO
/TIES=MEAN .
SELECT IF(rrv=1).
EXECUTE .
Regards
Raynald Levesque rlevesque@videotron.ca
----- Original Message -----
From: Stefan Jonsson <stefanj@POP.PSU.EDU>
Newsgroups: bit.listserv.spssx-l
To: <SPSSX-L@UGA.CC.UGA.EDU>
Sent: Tuesday, March 30, 1999 11:12 AM
Subject: slecting one child from a household
> Hello all.
>
> I have what simple problem but can not figure out the best(any) solution
to.
> My data set consists of about 19,000 children (the NHIS dataset) in
> somewhat fewer households (the HH coding scheme is bizare). I want to
> select exactly one child at random from within each household where there
> are 2 or more children and select the only child where there is only one
> child. Each household has at least one child, some HH have 2 other 3 etc.
>
> I have:
> HH# Child#
> 1 1
> 1 2
> 2 1
> 3 1
> 4 1
> 4 2
>
>
> I Want:
> HH# Child#
> 1 2 (or 1)
> 2 1
> 3 1
> 4 1 (or 2)
>
>
> Thanks,
> Stefan
>
> P.S. are the SPSS mailing messages archived somewhere on the www?