Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Display Variable Labels


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Display Variable Labels
Date   Thu, 27 May 2010 17:00:11 +0100

This was discussed earlier today in 

http://www.stata.com/statalist/archive/2010-05/msg01431.html

But note that your code is a loop around a varlist with a single
variable. So it reduces to 

display _newline(3) _column(4) as text "`: var label pwvssn'"
ta diag, sum(pwvssn)

A more general recipe runs like this 

foreach v of varlist <whatever> { 

	di `"`: var label `v''"' 

}

The compound double quotes `" "' are for any " inside the variable
label. 

Nick 
n.j.cox@durham.ac.uk 

Raphael Fraser

foreach var of varlist pwvssn {
        ...
	display _newline(3) _column(4) as text "`var'"
	ta diag, sum(`var')
	...
	}


How can I display the variable label rather than the variable name?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index