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-labelling multiple variables


From   Konrad <konradedgar@gmx.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re-labelling multiple variables
Date   Tue, 11 Jun 2013 00:58:24 +0100

Dear Statlist readers,

I would like to rename a set of variables by replacing a part of a string in variable label with another string. For instance, I imported a number of variables correponding to dependecy ratios. After the import each variable has a label grsapechildoldYEAR, I would like to replace first word with more meaningful text.

local changvrs grsapechildold2003 - grsapechildold2011
foreach var of varlist `changvrs' {
	label `var' regexr(`var', "grsapechildold", "Dependency Ratio (%)") 
	}

I don’t know how to mix string replacement commands with variable labelling. As usual, any help will be appreciated.



--
Regards
Konrad


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