Announcement

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

  • Marginsplot with prop

    I am using marginsplot command after prop command. With the graph, I only want the graph when the category is 1. Say, in the data below, I only want the graph when heartattack == 1. I tried keep if heartatk ==1 before creating the plot, it did not work. And 'if' option does not work with marginsplot.

    Code:
    webuse nhanes2, clear
    recode age (min/30=1) (31/40=2) (41/50=3) (51/60=4) (60/100=5), generate(ageCat)
    svyset [pweight=weight], strata(strata)
    svy: prop heartatk, over(race hlthstat)
    marginsplot, xdimension(hlthstat) bydimension(heartatk)  // recast(line) recastci(rarea) yline(0)
    Could anyone please help me with this?


    PS: GOT my answer #### SOLVED
    marginsplot, xdimension(hlthstat) graphdimension(heartatk) // recast(line) recastci(rarea) yline(0)

    Not deleting as this may be helpful to someone else!

    Last edited by bibha dhungel; 28 Mar 2024, 00:16.

  • #2
    Not deleting as this may be helpful to someone else!
    Thank you!!!

    Comment

    Working...
    X