The MEDIAN() function might return incorrect result when used with PROC SQL on numeric variables with a length less than eight


The MEDIAN() function might return incorrect results when used with the SQL procedure on numeric variables with a length less than eight. Here is an example:

data testdata;
   length var1 7;
   var1 = 10;
run;
proc sql;
   select median(var1) as med1 from testdata;
quit;

Here is the output:

med1
--------
18E-308

The correct result should be 10.