Date: Tue, 19 Jun 2007 10:40:02 -0400
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: Cross-referencing to value of another case
In-Reply-To: <5dq5stF35i8q6U1@mid.individual.net>
Content-Type: text/plain; charset="us-ascii"
Will:
proc sql;
create table twins as
select subject,twinpair,max(zygosity) as zygosity
from dataset1
group by twinpair
order by subject
;
quit;
The query selects the maximum value of zygosity for a twin pair. SAS SQL
happens to put missing values at the bottom of the collating sequence
(convenient in this case, but dangerous in general). I am assuming that
subjects without twins appear only once in a table.
S
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Will
Sent: Tuesday, June 19, 2007 10:01 AM
To: sas-l@uga.edu
Subject: Re: Cross-referencing to value of another case
Arild.Skogmo@klp.no skrev:
> what does your data look like?
Hallo,
to make my question more understandable:
How do I get from dataset1 to dataset2?
DATA dataset1;
INPUT
subject twinpair zygosity;
DATALINES;
0011 100 1
0012 100 .
0013 . . /* singleton, non-twin*/
0021 101 2
0022 101 .
RUN;
DATA dataset2;
INPUT
subject twinpair zygosity;
DATALINES;
0011 100 1
0012 100 1
0013 . . /* singleton, non-twin*/
0021 101 2
0022 101 2
RUN;
Thanks,
Will