Date: Mon, 31 Jul 2006 22:03:09 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: subsetting to unique values of a *single variable* in proc sql
In-Reply-To: <200607302244.k6UBFrxh024263@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed
rdbisch@GMAIL.COM wrote:
>Hala wrote:
> > hi all,
> >
> > My understanding is that 'distinct' in proc sql will subset to unique
> > observations--rows--. How can I subset to the unique values of a single
> > variable regardless of other variables in the same observation?
> >
> > example
> >
> > what I have:
> >
> > var1 var2
> > 1 45%
> > 2 45%
> > 3 45%
> > 4 45%
> >
> >
> > What i want:
> >
> > var1 var2
> > value doesnt matter 45% (REGARDLESS of what value var1 will take
> > upon subsetting)
> >
> >
> > Thank you very much!
> >
> > Hala
>Do you absolutely have to use SQL?
>
>proc sort data=yours; by var2; run;
>data yours; set yours; by var2; if first.var2; run;
>
You don't even have to work that hard.
proc sort data=yours out=mine nodupkey; by var2; run;
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/