Date: Tue, 18 Oct 2005 20:26:43 -0400
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bob Abelson <Bob_Abelson@HGSI.COM>
Subject: Re: PROC SQL:How to Calculate the MEDIAN with SQL
Content-Type: text/plain; charset=us-ascii
A contractor I once worked with wrote a macro to calculate the median in
SQL. I can't understand why he bothered, other than to prove he could do
it. Fortunately, he did it on his own time, but when you have PROC
UNIVARIATE at your disposal (this was before you could get quantiles with
PROC MEANS/PROC SUMMARY), it just seemed silly and pointless.
240 314 4400 x1374
"Gary W. Shaw" <Gary.Shaw@AUSTIN.PPDI.COM>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
10/18/2005 05:25 PM
Please respond to "Gary W. Shaw"
Subject: PROC SQL:How to Calculate the MEDIAN with SQL
Has anyone used SQL (in SAS or any other DBS) to determine the MEDIAN?
I like to use SQL to find counts, sums and other stats.
But SAS/SQL and I guess another ANSI SQL, does not have a Meidan()
My internet research has pulled up some solutions for SQL????
I have developed a solution in SAS/SQL ordering the data and using the
The solution works OK, but not straight SQL. That is it requires a few
This email transmission and any documents, files or previous email
messages attached to it may contain information that is confidential or
legally privileged. If you are not the intended recipient or a person
responsible for delivering this transmission to the intended recipient,
you are hereby notified that you must not read this transmission and
that any disclosure, copying, printing, distribution or use of this
transmission is strictly prohibited. If you have received this
in error, please immediately notify the sender by telephone or return
and delete the original transmission and its attachments without reading
or saving in any manner.