Date: Sun, 30 Mar 2008 14:22:50 -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: Distinct on proc sql -- Clarification
In-Reply-To: <200803292142.m2TAkZmG019970@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Art:
OK. I now see the reason for the question. Let's see whether the example
implies something other than a nodupkey constraint.
S
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Arthur Tabachneck
Sent: Saturday, March 29, 2008 5:43 PM
To: SAS-L@LISTSERV.UGA.EDU; Sigurd Hermansen
Subject: Re: Distinct on proc sql -- Clarification
Sigurd,
Suren indicated that he wants the first instance of product a, the
second instance of product b and, since there are only single instances
of products c and d, we don't know what he is looking for.
Art
---------
On Sat, 29 Mar 2008 17:32:09 -0400, Sigurd Hermansen
<HERMANS1@WESTAT.COM>
wrote:
>Howard:
>Isn't product the key in this case?
>S
>
>________________________________
>
>From: owner-sas-l@listserv.uga.edu on behalf of Howard Schreier <hs AT
>dc-
sug DOT org>
>Sent: Sat 3/29/2008 5:04 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Distinct on proc sql -- Clarification
>
>
>
>On Fri, 28 Mar 2008 13:43:02 -0400, Sigurd Hermansen
><HERMANS1@WESTAT.COM>
>wrote:
>
>>Suren:
>>You are describing the behaviour of SAS PROC SORT nodupkey ... It
>>arbitrarily takes the first instance of the value of a key in the obs
>>sequence of a SAS dataset.
>
>The B/3 row is a counterexample to the NODUPKEY model. It's not at all
>obvious to me what the rule is for picking an observation when PRODUCT
repeats.
>
>>S
>>
>>-----Original Message-----
>>From: owner-sas-l@listserv.uga.edu
>>[mailto:owner-sas-l@listserv.uga.edu]
>>On Behalf Of Suren gc
>>Sent: Friday, March 28, 2008 1:34 PM
>>To: SAS-L@LISTSERV.UGA.EDU
>>Subject: Distinct on proc sql -- Clarification
>>
>>
>>I want to select distinct variables from first column in the select
>>clause, however, it doesnot matter whether variables of other columns
>>are duplicated. Would this possible?
>>Data:
>>product Num
>>A 1
>>A 2
>>B 2
>>B 3
>>C 2
>>D 3
>>A 2
>>B 4
>>
>>I would want to select distinct products and create a dataset like
>>this: A 1 B 3 C 2 D 3
>>
>>Thanks,
>>Suren
|