Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: correlation, panel data


From   "Biljana Dlab" <[email protected]>
To   <[email protected]>
Subject   st: correlation, panel data
Date   Wed, 13 Oct 2010 15:56:48 +0200

Dear Statalist,

I have a beginner's question:

I have panel data (sorted by firm and financial years).

Now I am trying to compute correlation between variables r_d and cf - I would like to have this correlation in a separate column in spread-sheet and that the correlation coefficient is written for all firm-year observations

With other words this is what I would like to get:

Firm year corr(between r_d&cf)
A	99	0.2
A	00	0.2
A	01	0.2
A	02	0.2
B	99	0.4
B	00	0.4
B	01	0.4


I tried like this:

.by gvkey_n: corr cf r_d  - but then I get whole listing in front of me of the correlation and not the column in the spread-sheet

.by(gvkey_n): egen d_corr = corr(cf r_d) - this does not work :o(

Do you know the function how to get correlation in the column.

Thanks a lot.

Best,
Biljana


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index