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 (October 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 18 Oct 2005 20:26:43 -0400
Reply-To:     Bob_Abelson@HGSI.COM
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.

Bob Abelson HGSI 240 314 4400 x1374 bob_abelson@hgsi.com

"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"

To: SAS-L@LISTSERV.UGA.EDU cc: 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() function? My internet research has pulled up some solutions for SQL???? I have developed a solution in SAS/SQL ordering the data and using the MONOTONIC() function. The solution works OK, but not straight SQL. That is it requires a few SQL steps. Thanks, Gary

______________________________________________________________________ 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 transmission in error, please immediately notify the sender by telephone or return email and delete the original transmission and its attachments without reading or saving in any manner.


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