Announcement

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

  • Why did the box plot "relabel" command fail for category = 0?

    Hi, I'm trying to create a box plot for two variables: family value score and sex. However, I find if one of the categories of variable = 0 when I use the command "relabel", the command doesn't work. For example, here 0 = female and 1 = male. The plot can not label female (see the image above). However, if there is no 0 in the categorical variables, these command works very well. For example, here I have five age groups (see the image below).

    Code:
    graph box tradition_family_score, over(sex, relabel(0 "Female" 1 "Male") label(labsize(small))) ytitle( /// "Family Values (High: traditional. Low: non-traditional)"
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	68.3 KB
ID:	1741054
    graph box tradition_family_score, over(age_group, relabel(1 "64-" 2 "65-69" 3 "70-74" 4 "75-79" 5 "80+") label(labsize(small))) ytitle( /// "Family Values (High: traditional. Low: non-traditional)")
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	77.3 KB
ID:	1741055

  • #2
    The numbers do not correspond to the value labels but to the order of bars/ box plots from left to right. So, you need:

    Code:
    over(sex, relabel(1 "Female" 2 "Male")

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      The numbers do not correspond to the value labels but to the order of bars/ box plots from left to right. So, you need:

      Code:
      over(sex, relabel(1 "Female" 2 "Male")
      Thank you very much!

      Comment

      Working...
      X