
I have a dataset with three variables: date, var1, var2

 

How can I calculate the correlation, by date, between var1 and var2?

e.g.


date    var1    var2
1/1/2001    5    4
1/1/2001    8    5
1/1/2001    9    7

 

2/1/2001    7    2
2/1/2001    2    1
2/1/2001    4    6

 

3/1/2001    3    5
3/1/2001    4    3
3/1/2001    6    9
3/1/2001    7    -1

 

the results I want:
1/1/2001 0.891042111
2/1/2001 0.075093926
3/1/2001 -0.263117406



		
---------------------------------

	[[alternative HTML version deleted]]


