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]

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


From   Clinton Thompson <[email protected]>
To   [email protected]
Subject   Re: st: Removing the overall variable label and using only variable value in sts graph
Date   Fri, 24 Feb 2012 10:50:15 +0100

Perhaps you want to tweak the -legend- option?  For example:

webuse drug2
sts graph, by(drug) legend(rows(1) label(1 "1") label(2 "2"))

There are probably more elegant ways to approach the problem but on
the fly this seems to work.

Cheers,
Clint

On Fri, Feb 24, 2012 at 10:28 AM, Nick Cox <[email protected]> wrote:
> By variable label, I think you mean value label. Big difference!
>
> An easy way to do this is just to work with the result of
>
> gen drug2 = drug
>
> -drug2- inherits the values but not the value labels of -drug-.
>
> Nick
>
> On Fri, Feb 24, 2012 at 9:13 AM, Tim Evans <[email protected]> wrote:
>
>> 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.
>
> *
> *   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/

*
*   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