Standard Deviation calculation in asp pages

# Thread: Standard Deviation calculation in asp pages

1. Chris Johnson Guest

## Standard Deviation calculation in asp pages

Can anyone help me? I am trying to calculate the standard deviation of a string of numbers that I am querying into a recordset.

2. Senior Member
Join Date
Dec 1969
Posts
733

## RE: Standard Deviation calculation in asp pages

Here&#039s the general procedure...<BR><BR> For ctr1 = 0 To Nobs - 1<BR> Xtot = Xtot + Invals(ctr1)<BR> ss1 = ss1 + Invals(ctr1) * Invals(ctr1)<BR> Next<BR> Xmean = Xtot / CDbl(Nobs)<BR> Xstd = Sqr((ss1 - Xmean * Xtot) / (Nobs - 1))<BR>

3. SteveC Guest

## Why not let SQL do it?

From the help file...<BR><BR>Return estimates of the standard deviation for a population or a population sample represented as a set of values contained in a specified field on a query.<BR><BR>Syntax<BR><BR>StDev(expr)<BR>StDevP( expr)<BR><BR>The expr placeholder represents a string expression identifying the field that contains the numeric data you want to evaluate or an expression that performs a calculation using the data in that field. Operands in expr can include the name of a table field, a constant, or a function (which can be either intrinsic or user-defined but not one of the other SQL aggregate functions).<BR><BR>Remarks<BR><BR>The StDevP function evaluates a population, and the StDev function evaluates a population sample.<BR><BR>If the underlying query contains fewer than two records (or no records, for the StDevP function), these functions return a Null value (which indicates that a standard deviation can&#039t be calculated).<BR><BR>You can use the StDev and StDevP functions in a query expression. You can also use this expression in the SQL property of a QueryDef object or when creating a Recordset object based on an SQL query.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•