Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 correlation

Author  Topic 

dirwin26
Yak Posting Veteran

81 Posts

Posted - 2005-10-21 : 14:01:32
can anyone see why I would be returning a NULL value for this correlation?

SELECT
(COUNT(*)*SUM(x.Sret*y.SlopeDDX)-SUM(x.Sret)*SUM(y.SlopeDDX))/(
SQRT(COUNT(*)*SUM(SQUARE(x.Sret))-SQUARE(SUM(x.Sret)))*
SQRT(COUNT(*)*SUM(SQUARE(y.SlopeDDX))-SQUARE(SUM(y.SlopeDDX))))
correlation

FROM #res x JOIN #res y ON x.Sret=y.SlopeDDX

Cheers,
Dave

X002548
Not Just a Number

15586 Posts

Posted - 2005-10-21 : 14:10:19
Could you help us out with some DDL and sample Data

Check the hint link below....



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-10-21 : 14:41:26
Do your columns Sret, SlopeDDX allow NULL ?

_______________________
I have null problems...

rockmoose
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-10-21 : 14:41:40
you have division by zero somewhere?

Go with the flow & have fun! Else fight the flow
Go to Top of Page

dirwin26
Yak Posting Veteran

81 Posts

Posted - 2005-10-21 : 14:48:34
Both allow NULL's and there are no zeros.....

Dave
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-10-21 : 14:51:48
>> Both allow NULL's

Don't.

____________________
I have null problems...

rockmoose
Go to Top of Page
   

- Advertisement -