ok, creo que no siempre lo tendria directamente de una base de datos.
Asi que seria mejor:
"calcular la desviacion estandar de un arreglo de datos en ASP"
Encontre esto, es una funcion hecha por alguien en VB 5/6
Código:
'Function takes an array with numeric elements as a parameter
'and calcuates the standard deviation
Public Function StandardDeviation(NumericArray As Variant) _
As Double
Dim dblSum As Double, dblSumSqdDevs As Double, dblMean As Double
Dim lngCount As Long, dblAnswer As Double
Dim vElement As Variant
Dim lngStartPoint As Long, lngEndPoint As Long, lngCtr As Long
On Error GoTo errorhandler
'if NumericArray is not an array, this statement will
'raise an error in the errorhandler
lngCount = UBound(NumericArray)
On Error Resume Next
lngCount = 0
'the check below will allow
'for 0 or 1 based arrays.
vElement = NumericArray(0)
lngStartPoint = IIf(Err.Number = 0, 0, 1)
lngEndPoint = UBound(NumericArray)
'get sum and sample size
For lngCtr = lngStartPoint To lngEndPoint
vElement = NumericArray(lngCtr)
If IsNumeric(vElement) Then
lngCount = lngCount + 1
dblSum = dblSum + CDbl(vElement)
End If
Next
'get mean
If lngCount > 1 Then
dblMean = dblSum / lngCount
'get sum of squared deviations
For lngCtr = lngStartPoint To lngEndPoint
vElement = NumericArray(lngCtr)
If IsNumeric(vElement) Then
dblSumSqdDevs = dblSumSqdDevs + _
((vElement - dblMean) ^ 2)
End If
Next
'divide result by sample size - 1 and get square root.
'this function calculates standard deviation of a sample.
'If your set of values represents the population, use sample
'size not sample size - 1
If lngCount > 1 Then
lngCount = lngCount - 1 'eliminate for population values
dblAnswer = Sqr(dblSumSqdDevs / lngCount)
End If
End If
StandardDeviation = dblAnswer
Exit Function
errorhandler:
Err.Raise Err.Number
Exit Function
End Function
Necesito hacer alguna modificacion para q funcione con mi page?
o solo es copy-paste?
Estoy investigando la formula, en cuanto la enuentre la pongo.