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:16:11 +0100

Am Mittwoch, den 28.01.2009, 16:06 +0530 schrieb Ashim Kapoor:
> Dear all,
> 
> 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.

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

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