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 (August 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 14 Aug 2006 13:16:34 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: median in proc sql?

On Mon, 14 Aug 2006 11:16:44 -0400, Bob_Abelson@HGSI.COM wrote:

>I only have SAS 8.2 right now, but unless things have changed for Version >9, the answer is no.

Indeed things have changed (... but; see below).

> >1 proc sql; >2 select median(age) as med_age >3 from sashelp.class; >ERROR: Function MEDIAN could not be located. >4 quit; >NOTE: The SAS System stopped processing this step because of errors. >NOTE: PROCEDURE SQL used: > real time 0.03 seconds > cpu time 0.01 seconds

No error using v. 9.1.3.

But, the result is not the single median for the whole column AGE, but the trivial set of row-wise medians of single values.

PROC SQL allows use of nearly all SAS functions, so you can code something like MEDIAN(VAR,2,3) and when VAR=4 for example, you get 3 as the median. You are using the function as you might in a DATA step. PROC SQL however does *not* support MEDIAN as a summary stat, so you cannot call for MEDIAN(VAR) as you might in PROC MEANS.

> > >Bob Abelson >HGSI >240 314 4400 x1374 >bob_abelson@hgsi.com > > > >Hala <hala.maktabi@GMAIL.COM> >Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> >08/14/2006 11:05 AM >Please respond to >Hala <hala.maktabi@GMAIL.COM> > > >To >SAS-L@LISTSERV.UGA.EDU >cc > >Subject >median in proc sql? > > > > > > >Hi everyone, > > Does proc sql have a median function? > >Thanks :) > >Hala


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