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.
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!
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)
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!
Comment