Bookmark and Share

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

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

st: RE: Read variable labels

From   Nick Cox <>
To   "''" <>
Subject   st: RE: Read variable labels
Date   Mon, 21 Feb 2011 19:21:51 +0000

Suppose you want to replace "University" by "U" in a bunch of variable labels. 

foreach v of var * { 
	local label : var label `v' 
	local label : subinstr local label "University" "U", all 
	label var `v' `"`label'"' 

The key stuff here is documented at help -extended_fcn-. As Maarten was remarking only the other day, it's sometimes easier to remember to go to the help for -macro- and then jump. 

-varm- is good for doing this for a few labels. 


Liao, Junlin

Does anyone know how to read out variable labels? For example, I have a group of variables with long labels. I want to programmatically shorten the labels by replacing keywords. How do I get the variable labels in functions?

*   For searches and help try:

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