Date: Mon, 19 Jun 2006 11:41:12 +0800
Reply-To: Yan Shen <carnationshen@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yan Shen <carnationshen@GMAIL.COM>
Subject: Re: What does nodup do in proc sort?
In-Reply-To: <BAY101-F2767F2C2C8C84D3657666BDE860@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi, I chceked the SAS help in SAS 9. I found there were two options for
duplicate.
Eliminate duplicate observations
Delete observations with duplicate BY values NODUPKEY
Delete duplicate observations NODUPRECS
The NODUP you used was NODUPRECS. I think you can use NODUPKEY, by VARIABLES
(you want sort). Please try.
Joy
On 6/19/06, toby dunn <tobydunn@hotmail.com> wrote:
>
> Art ,
>
> The critical piece of info that you are missing about the nodup option is:
>
> Because NODUPRECS checks only consecutive observations, some
> nonconsecutive
> duplicate observations might remain in the output data set. You can remove
> all duplicates with this option by sorting on all variables.
>
> Toby Dunn
>
>
>
>
>
> From: Arthur Tabachneck <art297@NETSCAPE.NET>
> Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: What does nodup do in proc sort?
> Date: Sun, 18 Jun 2006 21:52:32 -0400
>
> While I have often suggested that one typically wants to use nodupkey in
> proc sort, a recent poster had a problem that sounded like nodup might
> have produced the desired result.
>
> However, in testing what I thought would occur, I got results that I
> wasn't expecting. The test data and sample program follow:
>
> data have;
> input id Dose score;
> cards;
> 1 100 10
> 1 100 22
> 1 200 15
> 1 100 30
> 2 100 5
> 2 100 30
> 2 200 10
> 1 100 10
> ;
> run;
>
> proc sort data=have out=want nodup;
> by id;
> run;
>
> Given the above, how many records should result in file 'want'?
>
> If your answer is 8, please explain why that result occurs.
>
> Thanks,
> Art
>
|