Announcement

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

  • Using putexcel in Stata to export outputs from the Stata kr20 user-written command - mata

    The problem:

    To use putexcel in Stata to export the table outputs from the Stata kr20 user-written command. The averages from the table are saved in four global macros:
    - $S_3: average value of item difficulties
    - $S_4: average value of corrected item-test PB correlation coefficients
    - $S_5: number of items
    - $S_6: KR20
    It is not clear where the rest of the table contents are saved.

    The requested solution:
    A Stata putexcel code to run at the end of my current code (below) to export to Excel the table outputs from the Stata user-written command, kr20.

    Current code:
    * set up
    set mat 11000
    set more off

    * get data
    qui: use http://www.stata-press.com/data/r15/masc2.dta

    *get kr20 estimates
    kr20 q*

    *use putexcel to export the kr20 estimates */
    * this is where I am stuck

    Many thank
    Gwin

  • #2
    Hello,
    Your question is solely in Stata but posted in the Mata forum. You can get a faster response by posting Stata questions in the General forum. That said, I check the ado file of kr20. Unfortunately, the table cells that you want to copy to an excel file are all locals in kr20 program, and I think they simply get erased from the memory once the program finishes. I think you would either need to edit the kr20.ado file to get it work with putexcel and do what you want, or perhaps just copy the table from the Stata results screen onto an Excel file. This second option is easier especially if you will not need to this many many times.
    Last edited by Cyrus Levy; 08 Jun 2019, 15:57.

    Comment

    Working...
    X