Announcement

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

  • Rearranging ordering of pie charts

    I'm creating simple graphics and disaggregating my data by assignment and sex. When I do the following:

    graph pie q_edu_3_a if q_edu_3_a!=99 & q_6_>=6, over(q_edu_3_a) by(assignment q_3_, title(What is the highest grade completed?) subtitle("Ages 6+ Disaggregated by Sex") rows(2)) plabel(2 percent) plabel(5 percent)

    .STATA orders the graphs in two rows (this is fine), with the first row containing: Control Male, Control Female, Lite Male, and the second row containing Lite Female, Classic Male, Classic Female

    What code can I use to make it so that the first row is Control Male, Lite Male, Classic Male and the second row (right beneath it) contains the female versions?

  • #2
    Stata [NB] is, it seems, not using alphabetic order here, but using whatever coding (mapping of values to value labels) you have defined. You need to clone the variable and recode. If this is mysterious, please show us the results of

    Code:
    tab assignment q_3_
    tab assignment q_3_,  nolabel
    You could do better with a bar or dot chart!
    Last edited by Nick Cox; 29 Oct 2014, 03:41.

    Comment


    • #3
      tab assignment q_3_

      | Sex of
      assignment | Male Female | Total
      ------------+----------------------+----------
      Control | 8,050 8,730 | 16,780
      CHC Lite | 7,299 8,091 | 15,390
      CHC Classic | 8,155 8,967 | 17,122
      ------------+----------------------+----------
      Total | 23,504 25,788 | 49,292


      ​tab assign q_3_, nolabel

      | Sex of
      assignment | 1 2 | Total
      -----------+----------------------+----------
      1 | 8,050 8,730 | 16,780
      2 | 7,299 8,091 | 15,390
      3 | 8,155 8,967 | 17,122
      -----------+----------------------+----------
      Total | 23,504 25,788 | 49,292

      Comment


      • #4
        I didn't read your code carefully enough, but it is now clear that male and female come from q_3_ so that I think all you need do is reverse the variables in the by() call to by(q_3_ assign).

        Comment

        Working...
        X