Statalist


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

Re: st: using another variable as a label


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: using another variable as a label
Date   Wed, 28 Jan 2009 13:40:06 +0100

Ashim Kapoor asked
> > I have a question. My dataset is like this.
> > 
> > Matchscore   order             ymonth
> > 200                 1                 1990m1
> > 280                 2                 1990m1
> > 290                 3                 1995m7
> > 300                 4                 2000m3
> > 251                 5                 2000m4
> > 
> > This is just a small part of the dataset, but it kind of gives the
> > message that ymonths are not evenly spaced and can be repeated ( this
> > is the reason I would not graph this by ymonth). So I want to graph
> > this by order but I want the corresponding values of ymonth displayed.
> > 
> > I want to do  something like : -
> > twoway ( line matchscore order )  , xlabel ( using ymonth in place of
> > order for the xlabel )
> > 
> > There is a clumsy way of pulling out the order values and ymonth
> > values and making a numlist but I was hoping there is something better
> > than this because I have to automate this process.

And I answered:

> I would use the -axis()- function of -egenmore-:
> 
> . egen newvar = axis(order), label(ymonth)
> . graph tw line matchscore axis, xlab(, valuelabel)
> 
> Note: egenmore is user written. Install it with
> 
> . ssc install egenmore

This should be only used if ymonth is either a string variable or a
labeled numeric variable. It seems that Ashim's ymonth variable is an
elapsed time variable. In this case you should use Roger's approach. 

Uli


-- 
[email protected]
030 25491-361

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index