Date: Mon, 11 May 2009 08:42:25 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: Selecting the Top n Values
In-Reply-To: <4A082697.7010108@virginbroadband.com.au>
Content-Type: text/plain; charset=ISO-8859-1
NOWARN
proc sql outobs=5 nowarn;
select * from sashelp.class
order by weight desc
;
quit;
On 5/11/09, John Chapman <john.chapman@virginbroadband.com.au> wrote:
> Of the various solutions kindly provided, the 'OUTOBS=' suggestion is
> the simplest and therefore, for me, the best, BUT when I tried it I got
> a warning message telling me that the sql procedure had ended
> prematurely due to the use of OUTOBS=
>
> I really wish SAS wouldn't warn me about something I clearly intended to
> do !
>
> Is this a bit buggish, or just another of thse features SI likes to
> provide "for the benefit of the user" ?
>
> Søren Lassen wrote:
> > John,
> >
> > Your're right, there is an SQL solution:
> >
> > proc sql outobs=50;
> > create table want as
> > select * from have order by sum_insured DESC;
> > quit;
> >
> > Regards,
> > Søren
> >
> > On Sun, 10 May 2009 10:32:43 +1000, John Chapman
> > <john.chapman@VIRGINBROADBAND.COM.AU> wrote:
> >
> >
> >
> > > I was hoping the following would work...
> > >
> > > proc sort data=policies out = top50(obs=50);
> > > by descending sum_insured;
> > > run;
> > >
> > > ...but it does not. The 'obs=50' doesn't cause an error, it's just
> ignored.
> > >
> > > I realise it's only a tiny overhead to add the following...
> > >
> > > data top50;
> > > set top50(obs=50);
> > > run;
> > >
> > > ... but, just out of curiosity, is there a one-step method? I expect the
> > > answer is sql, about which I am a novice.
> > >
> > > Running on Windows, 9.1.3 incidentally.
> > >
> > > Kind regards,
> > >
> > > John Chapman
> > > Sydney, Australia
> > >
> > >
> >
> >
> >
>
|