Issue with Box Plot Label

Issue with Box Plot Label

by Amber -
Number of replies: 1

Hi,

I have been looking over my charts and I've noticed that I have a problem with the labels.  I'm plotting change in bone mineral density by HIV status over 5 years.  I'm attempting to label HIV as HIV- (0) and HIV+(1).  When the graph is produced, 0 is renamed as HIV+ and 1 remains without a label.  For the year, 0 has no label, 2 becomes Year 2 and 5 remains without a label.  Any ideas on how to fix this?

graph box hip_neckbmd ///
, over(hiv, relabel( 0 "HIV-" 1 "HIV+" )) over(year, relabel( 0 "Baseline" 2 "Year 2" 5 "Year 5"))

Thanks,

Amber

In reply to Amber

Re: Issue with Box Plot Label

by Michael Peters -

Amber,

  Again, I would recommend labeling your variable in as your dataset itself.  As such the labels will appear in your graph.  

 

The code I use is 

label define HIV 1 "HIV pos" 0 "HIV neg", replace

label values HIV HIV