Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Including variable labels in graph titles


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: Including variable labels in graph titles
Date   Sat, 21 Oct 2006 16:17:40 -0400

. local mylabel : variable label myvar	

will capture the variable label from -myvar- and put
it into macro -mylabel-; you can then embed -mylabel-
in the title string.

hth,
Jeph



Dick Campbell wrote:
I need to produce a sequence of twoway overlay graphs for a set
of variables, say x1 x2 .... xk. Each variable has a label, e.g.
x1 "Label for variable x1" . I have written a do file which cycles
through the variables nicely using a foreach command, but I want to
include the label of the yaxis variable in the title of the variable.
I can't seem to find a way to capture the variable label so that it
can be embedded in the title. If there were some routine in Stata
that returned the label in a macro I could run it quietly, recover
the label and easily embed it in the title, but there doesn't seem to
be one. Does anyone have any ideas as to how this might be done?
Essentially, I want to this:

twoway (scatter mpg weight, sort), title(Scatter plot for (variable label to be inserted here).)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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