Hello,
I need to run correlations between variables - for simplicity let's say only between two variables X and Y - by company (I have around 200 companies).
I would like to export just the correlation the two variables (without the 1s) in a separate row for each company, and include the number of obs used and the company name.
Also, if there are no observations, I would like to keep the row with the label so that I know which companies don't have enough obs.
I've tried this, among other things, but cannot make it vertical (row by row) and I cannot add firm names, and for the missing ones I just get an error and the program stops.
foreach i in 111 112 122 124 {
eststo: estpost corr X Y if firm==`i'
}
esttab using "Table2_Corr15.csv", wide not nonumber nonotes b(%3.2f) nolines obslast label compress
Thanks a lot!
Related Posts with Export correlations by group (row by row and with a label for each group)
Regression for state-wide daily=data with fixed population percentageHello, So I have data set up as such (sample data that I just made up): Code: * Example generated b…
Why Stata graphs have different margins?Dear Statalists, I am plotting my estimated coefficients and its confidence intervals. But I found t…
Regression for state-wide daily data with fixed population percentage within statesHello, So I have data set up as such (sample data that I just made up): Code: * Example generated b…
Moving cumulative sum over 10-year periodDear Statalist Community, I am currently struggling with a data transformation task and was wonderi…
Reshape data from long to wide format using the rolling windowsDear all, I am desperately looking for your help. I am trying to reshape my data from long to wide …
Subscribe to:
Post Comments (Atom)
0 Response to Export correlations by group (row by row and with a label for each group)
Post a Comment