Announcement

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

  • export spearman results into excel file

    hi,

    I would like to export the result of "spearman, print(.05) star(.01)" command.
    I succeed with single "spearman" command, but I don't find the way to export, with "print(.05) star(.01)" options.

    I do
    spearman, print(.05) star(.01)
    putexcel set "export.xlsx"
    putexcel A1=matrix (r(Rho))

    Thanks in advance for your help.


    but it d'oesn't take into account



  • #2

    Code:
     putexcel A1 = "spearman, print(.05) star(0.01)"

    Comment


    • #3
      I'm afraid #2 does not solve the problem. It merely puts the specified string into the Excel file, not the results of the command.

      I believe the OP would like to put the matrix displayed by the spearman command, including the significance stars, into Excel. The italicised part is what it makes it hard, since the correlation coefficients itself can be easily taken from the returned matrix r(Rho).

      Consider
      Code:
      sysuse auto, clear
      spearman, print(.05) star(0.01)
      (make ignored because string variable)
      (obs=69)
      
                   |    price      mpg    rep78 headroom    trunk   weight   length     turn displa~t gear_r~o  foreign
      -------------+---------------------------------------------------------------------------------------------------
             price |   1.0000 
               mpg |  -0.5555*  1.0000 
             rep78 |            0.3098*  1.0000 
          headroom |           -0.4683*           1.0000 
             trunk |   0.4240* -0.6456*           0.6749*  1.0000 
            weight |   0.5014* -0.8567* -0.4138*  0.5193*  0.6621*  1.0000 
            length |   0.5015* -0.8463* -0.3854*  0.5348*  0.7342*  0.9508*  1.0000 
              turn |   0.3212* -0.7757* -0.4980*  0.4577*  0.6284*  0.8632*  0.8815*  1.0000 
      displacement |   0.4161* -0.8184* -0.4694*  0.4679*  0.6008*  0.9390*  0.8784*  0.8216*  1.0000 
        gear_ratio |  -0.3054   0.6608*  0.4275* -0.3903* -0.5187* -0.7877* -0.7319* -0.6812* -0.8701*  1.0000 
           foreign |            0.4440*  0.6069* -0.3274* -0.4244* -0.6484* -0.6115* -0.6713* -0.6989*  0.7070*  1.0000
      and then
      Code:
      putexcel set "export.xlsx", replace
      putexcel A1 = matrix(r(Rho)), names
      which results in:
      Click image for larger version

Name:	Screenshot 2022-10-03 at 7.49.30 PM.png
Views:	1
Size:	138.8 KB
ID:	1684114

      Comment


      • #4
        Keep the matrix line, just add the command line where ever you want it. Could push the matrix to B1, or add the command line under the matrix.

        Comment


        • #5
          Thanks a lot for your answers.
          I confirm, I want to export only the filtered datas with significance stars in my excel file. Not the whole matrix.
          Without success for now.

          Comment


          • #6
            a matrix won't hold stars. you'll have to use the probabilities and add stars through some other method. exporting to rtf or docx might be better.

            Comment

            Working...
            X