Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: How can I label a variable with a combination of two value labels


From   daniel klein <[email protected]>
To   [email protected]
Subject   Re: st: How can I label a variable with a combination of two value labels
Date   Fri, 4 Jan 2013 01:00:32 +0100

First, in your code you keep referring to <lbl>, where you should
refer to either <lbl_c> or <lbl_p>. However, these migth be typos and
it is unlikely they cause the "invalid syntax" errors.

Anyway, if your labels do not contain [compound (double)] quotes, a simple

forv j = 1/2 {
	forv k = 1/20 {
		la var var`j'_`k' "`: label lbl_c `j'' `: label lbl_p `k''"
	}
}

should do the trick.

If this does not work, I guess  we need more information on what your
labels look like.

Best
Daniel

-- 
I have two value labels lbl_c and lbl_p that take 2 and 20 values respectively

I also have 40 variables of the type var`i'_`j' where i = 1/2 and `j' = 1/20

I want to label each variable var`i'_`j' with a combination of lbl_c
`i' and lbl_p `j'

For a single label I would use -- label variable var`i' "`:  label lbl `i' '"

I tried various combinations of quotes of the form -- label variable
var`i'_`j'  "`"`:  label lbl `i' '" "`:  label lbl `j' '"'", but I
always get a syntax error message.

Does anyone know the correct combination of quotes that would make this work?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index