Date: Mon, 12 Oct 1998 17:55:54 -0700
Reply-To: "Self, Karsten" <kself@VISA.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Self, Karsten" <kself@VISA.COM>
Subject: Re: PROC SORT NODUP Option
Content-Type: text/plain
Comments below:
--
Karsten M. Self (kself@visa.com)
Trilogy Consulting
What part of "Gestalt" don't you understand?
> ----------
> From: LPogoda[SMTP:lpogoda@aol.com]
> Sent: Friday, October 09, 1998 5:53 PM
> To: SAS-L@UGA.CC.UGA.EDU
> Subject: Re: PROC SORT NODUP Option
>
> In article <3.0.3.32.19981007142641.008c1d60@comcat.com>, "Steven E.
> Stevens"
> <sstevens@COMCAT.COM> writes:
>
> >I heartily agree & cannot recall a single situation in the past 12 years
> I
> >have been programming with SAS that I have used NODUP (NODUPKEY is
> another
> >matter, though caution is still required).
>
> Isn't the use of NODUP exactly analogous to using SELECT DISTINCT in PROC
> SQL?
>
> Do you use SQL? Is it possible that you're not using NODUP because you're
> using SELECT DISTINCT instead?
>
>
[Karsten]
No, it is not, and this is one of the dangers of NODUP.
NODUP says that, after sorting by KEYS, ADJACENT identical records will be
reduced to a single output record. Identical, NONADJACENT records will not
be reduced to a single output record. If KEYS are VAR1 and VAR2, and
identical but non-adjacent values of VAR3 and VAR4 exist, the problem will
manifest itself.
SELECT DISTICT will, truly, select distinct values from a query. It is
similar in function to:
PROC SORT DATA= FOO NODUP;
VAR _ALL_;
RUN;
or
PROC SORT DATA= FOO DODUPKEY;
VAR _ALL_;
RUN;
SORT with the NODUP or NODUPKEY options still relies on the VAR statement in
determining what values are identified as distinct. SQL SELECT DISTINCT
results in distinct values of selected fields from the query expression.
|