Statalist


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

st: RE: using another variable as a label


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: using another variable as a label
Date   Wed, 28 Jan 2009 14:49:09 -0000

This is a very common need and there are several user-written solutions
for it. Ulrich Kohler mentioned my -egen- function -axis()- from
-egenmore- (although then changed his mind) and Roger Newson mentioned
his -sencode-. 

A command that is I think exactly what you seek is -labmask-. 

. search labmask 

FAQ     .  How to assign the val. of a var. as the val. labels of
another var.
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
Services
        5/08    http://www.ats.ucla.edu/stat/stata/faq/labmask.htm

Example . Code frag.: Hazard ratio of baseline char. by a dichotomous
variable
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
Services
        12/06   http://www.ats.ucla.edu/stat/stata/code/display_hr.htm

SJ-8-2  gr0034  . . . . . . . . . .  Speaking Stata: Between tables and
graphs
        (help labmask, seqvar if installed) . . . . . . . . . . . .  N.
J. Cox
        Q2/08   SJ 8(2):269--289
        outlines techniques for producing table-like graphs

reveals that the wonderful UCLA site contains two documents mentioning
-labmask- and also that since those documents were written I have
written up -labmask-'s application to graphs in the Stata Journal.
Regardless of whether you subscribe to the Journal you should install
-labmask- together with -seqvar- from the Stata Journal site. 

The code is also in the SSC package -labutil-, but installing from the
SJ site is better. 

Nick 
[email protected] 

Ashim Kapoor

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.

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