ADO / ASP / MEDIAN COMPUTATION
am 01.03.2005 13:56:59 von propedeutiqueHi,
I am looking for a way / an example to compute the median and
first/last quartils in ASP/ADO/SQL.
Thanks in advance for your answers.
Bi
Hi,
I am looking for a way / an example to compute the median and
first/last quartils in ASP/ADO/SQL.
Thanks in advance for your answers.
Bi
spectre wrote:
> Hi,
>
> I am looking for a way / an example to compute the median and
> first/last quartils in ASP/ADO/SQL.
>
> Thanks in advance for your answers.
>
By "SQL" do you mean "SQL Server"? If so, what version?
Here's a google search with some relevant results:
http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls =GGLC,GGLC:1969-53,GGLC:en&q=T%2DSQL+median
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Here's some treatment of MEDIAN:
http://www.aspfaq.com/2506
--
http://www.aspfaq.com/
(Reverse address to reply.)
"spectre"
news:ecc6dac0.0503010456.541027b6@posting.google.com...
> Hi,
>
> I am looking for a way / an example to compute the median and
> first/last quartils in ASP/ADO/SQL.
>
> Thanks in advance for your answers.
>
> Bi
Hi,
I mean sql server (as well as Ms Access as I use both type of databases)
Thanks
"Bob Barrows [MVP]"
> spectre wrote:
> > Hi,
> >
> > I am looking for a way / an example to compute the median and
> > first/last quartils in ASP/ADO/SQL.
> >
> > Thanks in advance for your answers.
> >
> By "SQL" do you mean "SQL Server"? If so, what version?
>
> Here's a google search with some relevant results:
> http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls =GGLC,GGLC:1969-53,GGLC:en&q=T%2DSQL+median
>
> Bob Barrows
Thanks for your help... any idea about quartil computation?
Bi
"Aaron [SQL Server MVP]"
> Here's some treatment of MEDIAN:
> http://www.aspfaq.com/2506
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "spectre"
> news:ecc6dac0.0503010456.541027b6@posting.google.com...
> > Hi,
> >
> > I am looking for a way / an example to compute the median and
> > first/last quartils in ASP/ADO/SQL.
> >
> > Thanks in advance for your answers.
> >
> > Bi
> Thanks for your help... any idea about quartil computation?
Need more information, since there are many variables. If you have 39 rows,
which quartile comes up one row short? If there are ties, what happens?
If you provide DDL, sample data, and desired results, you might get more
specific help.
http://www.aspfaq.com/5006
Thanks for your answer,
I have curently an application under access/vba with the following
code for median/quartil which works perfectly.
As you can see, the "quartil" (or, here percentile) can be defined
according to the user needs.
Being an "amateur", I am not sure enough to "translate" it in asp.
Thanks again.
Bi
The code is as followed, in vba:
Public Function XPercentile(FName As String, _
TName As String, _
x As Single) _
As Single
' FName = Field name
' TName = Table name
' x = decimal percentile (0.68 for 68%)
Dim intPercent As Integer
Dim strPartieEntiere As String
Dim strPartieDecimal As String
Dim dbValeur As Long
' Return the minimum value for which x% of
' the values are lower or equal to it
'If 1median table is empty, end function
If DCount("*", TName) = 0 Then
'MsgBox "No benchmark data available", vbInformation, "No
Data"
Exit Function
End If
dbValeur = x * DCount("*", TName)
intPercent = dbValeur
strPartieEntiere = CStr(intPercent)
intPercent = (dbValeur - intPercent) * 100
strPartieDecimal = CStr(intPercent)
XPercentile = DMin( _
FName, _
TName, _
"DCount(""*"", """ & TName & """, """ & FName & _
"<="" & [" & FName & " ]) >= " & _
strPartieEntiere & _
"." & _
strPartieDecimal & " " _
)
End Function
"Aaron [SQL Server MVP]"
> > Thanks for your help... any idea about quartil computation?
>
> Need more information, since there are many variables. If you have 39 rows,
> which quartile comes up one row short? If there are ties, what happens?
>
> If you provide DDL, sample data, and desired results, you might get more
> specific help.
>
> http://www.aspfaq.com/5006