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, 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" <>
To   <>
Subject   st: RE: Display Variable Labels
Date   Thu, 27 May 2010 17:00:11 +0100

This was discussed earlier today in

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


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:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index