Hello all,

I am new to stata and my work is about medical data.
My data are about diagnostic performance of different imaging modalities (I am using random data in the example). I have installed a stata extension called diagnostic test (the command is “diagt”, first variable is reference standard second the test, both are binary). In my analysis diagt is executed many times and I want to save/store the r-class data/values provided by the test e.g. sensitivity and specificity in order to summarize them later (at the end of the “do” file) in a table. I guess that diagt is not important and that it would be the same for all commands providing r-class data.

At the moment I store the values in macros and put the macros at the end in a matrix which I display with “matlist”.

My questions:
Is there an easier/more elegant way to store the r-class values and show them in a table afterwards?
It seems not optimal that I must specify each value I want to use later and put it into a macro. Is it possible to store all the r-class data at once and display specific values later?

Code:
// run diagt
diagt fasitb MRtb

// save some r-class data
global MRt_sens = r(sens)
global MRt_spec = r(spec)

// run diagt for another modality/test
diagt fasitb MRnb

// save the same r-class data into different macros
global MRn_sens = r(sens)
global MRn_spec = r(spec)

// now I generate my matrix and the summary table

matrix A = $MRn_sens, $MRn_spec\ $MRt_sens, $MRt_spec \ $MCC_overall, . \ $MCC_sens, $MCC_spec
matrix rownames A = "MR nativ" "MR toilax" "McNemar Overall, Nativ vs Toilax" "McNemar sens spec"
matrix colnames A = sensitivity specificity
matlist A, format(%15.1f) twidth(40) title(Summary of Results)
My table looks like this:
Array


Here a list over all r-class data provided by diagt and I will probaly use several of them.
Code:
return list

scalars:
               r(sens) =  50.12003200853561
            r(sens_lb) =  48.50661567935583
            r(sens_ub) =  51.73326103478671
               r(spec) =  49.96000639897616
            r(spec_lb) =  48.71277950932287
            r(spec_ub) =  51.20727063140053
               r(prev) =  37.49
            r(prev_lb) =  36.53994481639038
            r(prev_ub) =  38.44734619397738
                r(ppv) =  37.52746155382465
             r(ppv_lb) =  36.18391913702044
             r(ppv_ub) =  38.8855612589619
                r(npv) =  62.54756659323052
             r(npv_lb) =  61.1880343889589
             r(npv_ub) =  63.89241263219665
                r(lrp) =  1.001599488763926
             r(lrp_lb) =  .9619277032697625
             r(lrp_ub) =  1.042907416515918
                r(lrn) =  .9983979504151261
             r(lrn_lb) =  .9587131869858447
             r(lrn_ub) =  1.039725416239468
                 r(or) =  1.003206675602117
              r(or_lb) =  .9251808504343817
              r(or_ub) =  1.087812866382799
                r(roc) =  .500400185585022
             r(roc_lb) =  .490277306910667
             r(roc_ub) =  .510523064259377
              r(oprev) =  .
           r(oprev_lb) =  .
           r(oprev_ub) =  .
               r(opos) =  .
            r(opos_lb) =  .
            r(opos_ub) =  .
               r(oneg) =  .
            r(oneg_lb) =  .
            r(oneg_ub) =  .
Any help would be appreciated very much!