Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Save stored matrix as dataset

    I have a dataset that looks like this:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(pct_total113300 pct_total115100 pct_total115200 pct_total211100 pct_total212100)
     100  100  100   100  100
     2.9 2.24 4.64 10.07 3.41
     .44  .24  .32   .61  .32
    1.88  .87 1.82  3.85  1.6
       .    .    .     .    .
       .  .02    .     .    .
       .    .    .   .22    .
       .  .12  .24    .2    .
       .  .01    .   .13    .
       .  .01    .   .29  .06
       .    .    .   .15    .
     .14  .11  .28  1.36  .27
       .  .04    .   .39  .17
     .08  .09    .   .28  .14
       .    .    .   .13  .17
       .  .06    .   .13   .1
     .17  .56 1.11     .    .
       .    .    .     .    .
       .    .    .     .    .
       .    .    .     .    .
    end
    (In the actual dataset, there are 294 variables, each having 734 observations - which is too big to display here.)

    I want to get the correlation between every pair of variables and put that into a matrix. In this matrix, the correlation between variable i and j is in entry i,j. I've tried typing in -pwcorr- and according to Stata's rocrrelate.pdf, the pairwise correlation matrix is stored in r(C). How do I put r(C) into a dataset with each row and column labelled by the right variable?
    Last edited by Xiaoyang Li; 06 Jun 2018, 16:22.
Working...
X