Announcement

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

  • Problem with the customizable tables using the table() command

    Dear all,

    I was trying to export results from a logistic regression using the solution suggested on the stata blog
    https://blog.stata.com/2021/08/26/cu...ression-model/

    So I followed this example and modified the code. I probably messed up somewhere, because when I want to export my beautiful table with putdocx I get error r(132) too few quotes.


    please find my code below:

    table () (command result), command(_r_b _r_se _r_z _r_p _r_ci : logistic mask_mand age female i.country i.edu i.Income s_risk_infection s_risk_health s_risk_family s_risk_community risk_aversion altruistic, vce(r)) nformat(%5.2f _r_b _r_se _r_ci) nformat(%5.4f _r_p) sformat("[%s]" _r_ci ) cidelimiter(,)

    collect label levels result _r_b "Odds Ratio", modify
    collect label levels command 1 "Logistic Regression Model for mandatory mask wearing", modify
    collect style showbase off
    collect style row stack, delimiter(" x ") nobinder
    collect style cell border_block, border(right, pattern(nil))

    collect preview

    putdocx clear
    putdocx begin
    collect style putdocx, layout(autofitcontents) title("Table x: Logistic Regression Model for mandatory mask wearing ")
    putdocx collect


    This is where I get the error

    I tested out several things but I can't find the point where I miss a quote.

    I would be very thankful for your help. I'm new to the customised tables in Stata, the result looks great, but I can't export it.

    Best regards
    Sebastian

Working...
X