Announcement

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

  • new var calculated from group means of survey data

    Greetings,

    I working on Stata 15 with survey data using pweights. I have created the bar graph below showing the mean proportion of people reporting an illness and the proportion of those reporting an illness that sought care by quintile for a sub-population. I used the following code:

    Code:
    graph bar (mean) Illness_YN (mean) Consult_illness_YN [pweight = weightperill] if subpop ==2, over(quintile_expend2) blabel(bar) scheme(s2manual)
    Figure 2 draft.gphNow, for each quintile I need to multiply the mean results for Illness_YN and Consult_illness_YN. I have made many attempts using egen, but cannot figure out how to apply pweights. I welcome any suggestions.

    I am also looking to convert those bar labels to %. Thanks much.

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - in addition to Stata code, include readable Stata output and sample data using dataex. Many of us won't open files.

    I'm not sure what you intend. If you want to multiple two variables, that is gen x12= x1 * x2. If you want means by something, then bysort something: egen mean=mean(x).

    Have you looked at the documentation - the index says weights, [G-2] graph twoway scatter.


    Comment

    Working...
    X