>>"Median" ? Is it the value sitting in middle in a series ? If so and number of elements <= 65000 a simple way might be :
>>
select myValue into array myArray where !isnull(myValue)
>>if type("myArray") # "U"
>> if alen(myArray,1) > 1
>> return myArray[floor(alen(myArray,1)/2) + 1]
>> else
>> return myArray[1]
>> endif
>>endif
>>return .null.
Cetin
>
>Median should be the midpoint value in a data set.
>
>declare myArray[6]
>myArray[1]=22353
>myArray[2]=35645
>myArray[3]=46000
>myArray[4]=100000
>myArray[5]=105000
>myArray[6]=198000
>if type("myArray") # "U"
> if alen(myArray,1) > 1
> ? myArray[floor(alen(myArray,1)/2) + 1]
> return myArray[floor(alen(myArray,1)/2) + 1]
> else
> ? myArray[1]
> return myArray[1]
> endif
>endif
>return .null.
>
>This gives me the median at 100000. If I run the same set of data through Excels data anyalysis/descriptive statistics it gives me 73000 (which is (46000+100000)/2). What's right?
>
>/Chris
Chris,
Go Bruce's way. He knows this and with the formula he supplied that is same as in Excel.
Cetin