Announcement

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

  • Creating graph by percent

    Hi,

    I have the following survey variabels: 1. Schooling attitudes 2. Gender. 3. Years

    I would like to make a graph showing how big share among women and men that answered the third alternative in schooling attitudes over all the years that the question has been asked. I can of course do it manually, just simple "tab gender schoolingattidues, row" and look at each year seperately but I'm sure there is a much easier way.

    /Marcus

  • #2
    No data example, and I have to make some guesses about what you want. But this may help.


    Code:
    * 2 genders, 3 attitudes, 4 years 
    clear 
    set obs 240
    set seed 2803
    set scheme s1color 
    
    gen female = _n > 120 
    label def female 0 male 1 female 
    label val female female 
    egen year = seq(), from(2018) to(2021) block(30)
    gen attitude = runiform()
    replace attitud e = cond(attitude < 0.2, 1, cond(attitude < 0.5, 2, 3))
    
    egen toshow = mean(100 * (attitude == 3)), by(female year)
    
    separate toshow, by(female) veryshortlabel 
    
    twoway connected toshow? year, ytitle(% with attitude 3) lc(blue orange) mc(blue orange) note(C.S. Peirce wrote about thirdness) xtitle("")
    Click image for larger version

Name:	thirdness.png
Views:	1
Size:	30.1 KB
ID:	1659642

    Comment

    Working...
    X