Announcement

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

  • Line graph showing percentage of catvar

    Hello,
    I want to show over the years how the percentage of two subgroups of a catvar are changing (in relation to the total subgroup).
    So: Over the years how many men are married relative to the overall number of men and accordingly for women.

    tab marriagestatus year, col
    by year, sort: egen married= mean(100*marriagestatus)
    label variable married"married"

    Graph
    twoway line married year if sex==1 ///
    || line married year if sex==2 ///
    xtitle(Year) xlabel(#14) ///
    ytitle(Marriage(%)) ylabel (0(10)100)

  • #2
    I think you need to step back and calculate

    Code:
    by year sex,  sort: egen married= mean(100*marriagestatus)
    and then you have separate means for each sex and year.

    Comment

    Working...
    X