Announcement

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

  • Bar graph with an ampersand in a compound string in a variable label

    I'm using compound strings to label data that needs to go on two rows on the x-axis of a bar graph. However, if the string contains an ampersand (&), the command gives a "type mismatch" error. This problem only exists if the ampersand is in the compound string.
    For example:

    Code:
    sysuse auto, clear
    label define rep_label 1 "A&B" 2 `" "first line +" "second line" "' 3 "C" 4 "D" 5 "E"
    label values rep78 rep_label
    tab rep78
    graph bar price, over(rep78)
    works fine, but when I change the "+" to a "&", I get the "type mismatch error":

    Code:
    sysuse auto, clear
    label define rep_label 1 "A&B" 2 `" "first line &" "second line" "' 3 "C" 4 "D" 5 "E"
    label values rep78 rep_label
    tab rep78
    graph bar price, over(rep78)
    Is there a way for me to include the ampersand in a compound string?

  • #2
    Seems like a parsing bug. I'd go straight to StataCorp Technical Services.

    Comment

    Working...
    X