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]
Re: st: correlation, panel data
From
Maarten buis <[email protected]>
To
[email protected]
Subject
Re: st: correlation, panel data
Date
Wed, 13 Oct 2010 15:25:50 +0100 (BST)
--- On Wed, 13/10/10, Biljana Dlab wrote:
> 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
> I tried like this:
> .by(gvkey_n): egen d_corr = corr(cf r_d) - this does not
> work
You should have written:
by gvkey_n: egen d_corr = corr(cf r_d)
For an explanation, see -help by-.
Hope this helps,
Maarten
Ps. You made two common errors in your post:
1) A statement like "does not work" is not very informative.
More informative is to say what you expected, and what it
actually did. Especially these exact three words happen
so often that they invoke negative emotions, so in future
you might want to avoid them.
2) the -corr()- command inside -egen- is user-writen. It
comes from -egenmore-, which can be downloaded by typing
-ssc install egenmore-. Posters are asked to explicitly
state where they downloaded user written programs as there
are often multiple versions floating around in cyber space,
and answers often depend on the version.
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/