LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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. > >Thanks!

proc sql outobs=10; /* limit to first 10 results */ select groupvar, count(*) from table group by groupvar order by 2 desc; /* this is how you make them the TOP 10 */ run;

Steve Raimi


Back to: Top of message | Previous page | Main SAS-L page