Announcement

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

  • proper() function for graph title

    I'm generating scatterplots automatically and I want to make sure the titles are properly capitalized. This doesn't work:
    webuse auto, clear
    foreach x in mpg headroom trunk {
    scatter price `x', title(proper("price and `x'"))
    }
    The word "proper" appears literally in the title. Is there a way that works?

  • #2
    Maybe
    Code:
    title(`=strproper("price and `x'")')

    Comment


    • #3
      That works -- wow! How did you figure that out? I'm having trouble parsing your syntax.

      Comment


      • #4
        This is documented tersely under

        Code:
        help macro
        The syntax is that expressions generically exp in

        Code:
        `=exp'
        are evaluated and their result is used in the command in which they are embedded.

        Code:
        . di "The answer is `=6 * 7'"
        The answer is 42
        My expression was

        Code:
        6 * 7
        which Stata evaluated; its result was what was shown. (In the case of display, there are other ways to do it, a different point.)

        Comment


        • #5
          I am not sure about it

          Comment

          Working...
          X