Date: Tue, 11 Mar 2008 15:04:01 -0400
Reply-To: Steven Raimi <sraimi@MARKETINGASSOCIATES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Steven Raimi <sraimi@MARKETINGASSOCIATES.COM>
Subject: Re: How to Proc SQL select top N records?
On Tue, 11 Mar 2008 11:40:29 -0700, Ruve <bandbig@GMAIL.COM> wrote:
>How to Proc SQL select top N records in SAS?
>Just like "Select Top 10" in SQL Server? I just want to see the top
>10 results without having to saving all query results into a dataset.
proc sql outobs=10; /* limit to first 10 results */
select groupvar, count(*)
group by groupvar
order by 2 desc; /* this is how you make them the TOP 10 */