Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Removing the overall variable label and using only variable value in sts graph


From   Tim Evans <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Removing the overall variable label and using only variable value in sts graph
Date   Fri, 24 Feb 2012 09:24:24 +0000

Hi all,

Seems I didn't look hard enough, this does the trick:

sysuse cancer.dta, clear
stset studytime, failure(died)
drop if drug == 2
sts graph, by(drug) ///
legend(label(1 "1") ///
label(2 "3"))


However, how do you find out which order your labels come in - I had to try a few combinations to get the right order (I was relabelling the confidence intervals until I changed it) - is there a more eloquent way of listing the relative order of each value in the legend?


Best wishes

Tim


-----Original Message-----
From: Tim Evans 
Sent: 24 February 2012 09:14
To: '[email protected]'
Subject: Removing the overall variable label and using only variable value in sts graph

Hi all,,

I'm using Stata 11.2 and am creating and exporting some Kaplan Maier curves but I want to drop the variable label from the legend in my sts graph so that I only have the value rather than both.

For instance, if I run the following code:

webuse drug2
sts graph, by(drug)

I end up with a legend that shows drug = 0 and drug = 1

What I would like to do is drop the 'drug' and return only 0 or 1. There are many reasons for this, not least because if I have more than a few values in the variable, the legend becomes a little unwieldy and I also entitle the graph so that its clear what I'm graphing.

I've had a search around on Google but don't seem to be able to find exactly what I want. So any help gratefully received.

Best wishes

Tim
_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index