[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: Turn obs into vars
From: Mary <mlhoward () avalon ! net>
Date: 2008-04-30 20:04:12
Message-ID: 01fd01c8aafd$5d4c2be0$832fa8c0 () HP82083701405
[Download RAW message or body]
Sorry, I forgot to change my variable name to ID. Here's the correction.
proc sql;
create table duplicates as
select id
from vars
where id in(
select id
from vars
group by id
having count(id) >=2)
order by id;
quit;
run;
I'm actually doing a similar thing myself; our lab has run DNA results multiple times \
on the same people, and we would like to aggregate them to having 1 row per patient \
so that we can run statistical analysis on them (I've got over 200 variables like \
this), but we have just one variable that documents what plate the DNA was run on, so \
I want to flip that one variable(which has only up to 2 values per patient) and \
aggregate the rest of the data. There's only about 100 duplicates out of thousands \
of lines, so it is really not worth the hassle to keep the plate as part of the \
primary key along with the id.
Thus I do see the need for what you are doing.
-Mary
----- Original Message -----
From: Erica
To: SAS-L@LISTSERV.UGA.EDU
Sent: Wednesday, April 30, 2008 12:12 PM
Subject: Turn obs into vars
Hello all,
I have a SAS dataset that looks like this:
ID Source ...10 Other Vars...
1 V
1 S
2 V
3 V
3 S
3 R
I want:
ID Source1 Source2 Source3 ...10 Other Vars...
1 V S
2 V
3 V S R
Any help would be greatly appreciated!
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic