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)
Iterations in ARDL modelsDear Stata users, I am conducting a study using a panel of 48 countries over 1981-2018. The followi…
Difference between dates in monthI have dates %tdD_m_Y format and I want to create an indicator if they are exactly one month apart, …
How to generate cubic turning points?Esteemed Statalisters, Please I use Stata 16 and need your assistance with deriving cubic turning p…
How can I get difference between two dates in daysHello, I want to get the difference between these two dates (Fenddt - Rptdt) in days at a new variab…
Copying rdrobust results with another type of regression Code: rdbwselect black maxscoreraw17,c(-0.9136) vce(cluster refer_id) local bw=e(h_1) regress black…
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