Value labels are associated either with a valuelabelname or a varname (to which a valuelabelname has been attached).
Thus, you must make reference to one of these to extract a particular value label.
The two forms would be:
`:label valuelabelname `i''
`:label (varname) `i''
You must include the () if you use the varname approach.
Tom
Thomas J. Steichen
[email protected]
----------------------------------------------------------------------------
Facts do not cease to exist because they are ignored. - Aldous Huxley
----------------------------------------------------------------------------
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Siyam, Amani
> Sent: Thursday, July 21, 2005 2:59 AM
> To: [email protected]
> Subject: st: Displaying value labels within a" foreach" statement
>
>
> Dear Stata-listers,
>
> I have the following foreach statement:
>
> foreach i in 8 11 14 17 20 {
>
> foreach j in x y z {
>
> display " Daily intake `j' at age `i'
> months"
>
> tabstat `j' if vnum==`i', by(site) stats(mean sd)
> col(stats)
> }
> }
>
> There are value labels for the values 8 11 14 17 20 that "i"
> takes that I wish to display. Is there a way I can do that, I
> tried adding extra quotes around ``i'' in the "display"
> statement, but it did not work.
>
>
> Many thanks for your help in advance.
>
>
> Amani
>
>
> *
> * 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/
>
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the attorney-
client or other legal privileges, and/or proprietary non-public
information. If you are not an intended recipient of this message or an
authorized assistant to an intended recipient, please notify the sender by
replying to this message and then delete it from your system. Use,
dissemination, distribution, or reproduction of this message and/or any of
its attachments (if any) by unintended recipients is not authorized and
may be unlawful.
*
* 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/