Announcement

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

  • collect composite does not work to combine coefficients and confidence intervals into a single cell result

    Hi everybody,

    I am working with the collect commands to build a regression table in Stata 17. I manage to create the table, but I want to have in the same column results for coefficients (in this case OR) and confidence intervals. When I include "collect composite" in the code, nothing happens, and the produced table continues to show in separate columns results for coefficients and confidence intervals. This is my code:

    [collect create stratagecatdiab

    collect _r_b _r_ci, name(stratagecatdiab) ///
    tag(model[(Diabetes Odds 40 - 60 years)]) ///
    : logistic diab_inc i.f1dpiohquar f1age i.gender i.f1edtyp4 f1pa i.f1smk i.f1alccat f1kcaltot i.f1dieting f1bmi if f1agecat==0

    collect _r_b _r_ci, name(stratagecatdiab) ///
    tag(model[(Diabetes Odds > 60 years)]) ///
    : logistic diab_inc i.f1dpiohquar f1age i.gender i.f1edtyp4 f1pa i.f1smk i.f1alccat f1kcaltot i.f1dieting f1bmi if f1agecat==1

    collect dims
    collect levelsof model
    collect label list model, all

    collect levelsof result
    collect label list result, all

    collect layout (model) (colname#result)
    collect label levels result _r_b "Odds Ratio", modify
    collect stars _r_p 0.001 "**" 0.05 "*", attach(_r_b)
    collect style cell result[_r_ci], sformat("(%s)") ///
    cidelimiter(,)
    collect composite define orci = _r_b _r_ci, trim
    collect style showbase off
    collect style cell border_block, border(right, pattern(nil))
    collect style cell, nformat(%5.2f)]

    Is my code wrong? what am I missing? I appreciate your help.

    Kind regards,

    Magda
    Last edited by Magda Gamba; 01 Feb 2023, 05:15.
Working...
X