Sample 24676: Determine the MEDIAN in SAS 9.0 and beyond
Find the middle value of a distribution.
Note:
With an odd number of variables, the median will be the
single value that falls at the midpoint of the
distribution. With an even number of variables the
median will be the mean of the middle two values in the
distribution.
See Determine the MEDIAN value prior to SAS 9.0 for earlier releases.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data test;
input x1 x2 x3 x4 ;
med_1_3=median(x1,x2,x3);
med_1_4=median(of x1-x4);
datalines;
24 25 27 100
4 2 16 1000
;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs x1 x2 x3 x4 med_1_3 med_1_4
1 24 25 27 100 25 26
2 4 2 16 1000 4 10
Find the middle value of a distribution.
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step SAS Reference ==> Functions
|
| Date Modified: | 2005-12-23 03:02:57 |
| Date Created: | 2004-09-30 14:09:03 |
Operating System and Release Information
| SAS System | Base SAS | Tru64 UNIX | 9 TS M0 | n/a |
| OpenVMS Alpha | 9 TS M0 | n/a |
| HP-UX IPF | 9 TS M0 | n/a |
| Linux | 9 TS M0 | n/a |
| 64-bit Enabled Solaris | 9 TS M0 | n/a |
| 64-bit Enabled HP-UX | 9 TS M0 | n/a |
| 64-bit Enabled AIX | 9 TS M0 | n/a |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | n/a |
| z/OS | 9 TS M0 | n/a |