Date: Thu, 13 Jan 2005 09:34:58 -0500
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Transposing Variables
Elly,
You can also solve your dilemma with a data step and use of proc sort's
nodupkey option. For example,
data foo (drop=hold);
array Var[2] $;
input ID Var1 $ Var2 $ Num;
if Var1 <= Var2 then do;
Var[1]=Var1;
Var[2]=Var2;
end;
else do;
Hold=Var2;
Var[2]=Var1;
Var[1]=Hold;
end;
cards;
1 AA AB 1
1 C AC 2
1 AB AA 3
1 AD AF 4
2 YU KO 5
2 KO YU 6
run;
proc sort data=foo nodupkey;
by id var1 var2;
run;
Art
----
On Wed, 12 Jan 2005 23:19:37 -0500, Elly Hodges
<new_biostat_person@HOTMAIL.COM> wrote:
>I need to somehow eliminate duplicates. It doesn't appear that there are
>duplicates but there are. For example, for subject ID=1, numbers 1 & 3 are
>exactly the same except that the response listed under each variable is
>reversed. Also, ID=2, the 2 lines are the same. I need to delete one of
>these lines that is the duplicate, and it doesn't matter which one is
>deleted. There are more than 1 million observations in my data set, so I
>can't easily just look at the data and delete the duplicates.
|