Announcement

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

  • Labelling boxes

    I have a box plot with a box by categories (over) where each category is a unique date. The x axis is labeled with 5-digit Stata dates (eg. "23362") rather than the formatted date ("18dec2023"). How do I get the labels to appear in %td format? Stata 18.

    Code:
    graph box sbp , over(date, label(format(%tdMon-DD)))
    Thanks

    Ben Littenberg

  • #2
    graph box is expecting categories for one axis, so value labels will work.


    Code:
    levelsof date, local(dates)
    
    foreach d of local dates { 
        label def mylabels `d' "`: di %tdMon-DD `d''", add 
    }
    
    label val date mylabels 
    
    graph box sbp, over(date)

    Comment


    • #3
      Thanks a million!

      Comment

      Working...
      X