Announcement

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

  • -putexcel- : How to include stored Matrix results

    Hello, I'm using -putexcel- to export to spreadsheet the stored results of an SSC command -kappaetc-.
    The following code successfully exports to spreadsheet all requested items (Column headers, and Scalars) except for the last line of my code, which calls for a stored Matrix. Any advice would be much appreciated.

    Code:
        webuse rvary2, clear
        kappaetc rater1-rater5
        putexcel set stata-example_results.xlsx, modify
        putexcel A1 = "Command", bold
        putexcel B1 = "Number of subjects", txtwrap bottom bold
            putexcel B2 = (r(N)), hcenter
        putexcel C1 = "Number of raters", txtwrap bottom bold
            putexcel C2 = (r(r)), hcenter
        putexcel D1 = "Min. number of ratings per subject", txtwrap bottom bold
            putexcel D2 = (r(r_min)), hcenter
        putexcel E1 = "Max. number of ratings per subject", txtwrap bottom bold
            putexcel E2 = (r(r_max)), hcenter
        putexcel F1 = "Avg number of ratings per subject", txtwrap bottom bold
            putexcel F2 = (r(r_avg)), hcenter
        putexcel G1 = "Proportion agreement expected"
            putexcel G2 = matrix list r(prop_e)
    I note that the error message states "list: matrix expression must be enclosed in ()". However, all the variations of using the requested parentheses I can think of are unsuccessful in completing the code set:
    Code:
         putexcel G2 = (matrix list r(prop_e))
         putexcel G2 = matrix (list r(prop_e))
         putexcel G2 = matrix list (r(prop_e))
         putexcel G2 = matrix (list (r(prop_e)))

  • #2
    Stumbled over this today. I think the syntax should be

    Code:
    putexcel G2 = matrix(r(prop_e))
    Best
    Daniel

    Comment


    • #3
      Works perfectly, Daniel. Thank you!

      Comment


      • #4
        Hi both,

        I stumbled across this helpful post while trying to use -putexcel- with a contrast statement. I am wondering if either of you would know the correct syntax for getting the 95% CI limits out of the contrast statement. Here's what I have:
        Code:
        logistic flu_case curr_vax##prior_vax season
        
        contrast curr_vax#prior_vax, effects eform

        I can then see the 95% CI lower limit ("ll") and upper limit ("ul") values by typing
        Code:
        matrix list r(table)
        which gives me a 1x9 matrix, with the LL and UL values at the [1,5] and [1,6] positions respectively.


        When I add
        Code:
        putexcel D5 =  matrix(r(table)[1,5])
        I receive the message that my putexcel file was saved, but no changes to the document are apparent. Does anyone know whether saving individual elements of r(table) is even possible using -putexcel-? Is there a change I can make to the syntax to get this to work properly? Apologies if I'm missing something obvious!

        Comment

        Working...
        X