Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: question about labelling


From   "Steichen, Thomas" <STEICHT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: question about labelling
Date   Thu, 27 Feb 2003 12:56:11 -0500

Radu Ban writes:

> I have a lot of variables of the type
> 
> xyz101 xyz105 xyz211...
> 
> and I want to label them like this:
> 
> label var xyz101 "[description] 101"
> 
> 
> I would like to know whether I can speed up this labelling 
> process, since I have over a hundred of these variables. I 
> tried the following piece of code:
> 
> foreach `name' of varlist xyz* {
> 	local code = substr(`name', -3, .)
> 	label var `name' `"indigineous input # `code'"'
> 	}
> 
> but it gives me a type mismatch, which makes me believe 
> -substr- is trying to extract the string out of the variable 
> itself not its name. Can anyone point the way oout?

Put `name' in quotes in the substr() function.

Tom

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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index