Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: converting variable labels to proper case with apostrophes


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: converting variable labels to proper case with apostrophes
Date   Fri, 21 Jul 2006 23:19:08 +0100

foreach v of var _all { 
	label var `v' `"`= proper(`"`: var label `v'"')"' 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Dimitriy V.
> Masterov
> Sent: 21 July 2006 22:41
> To: Statalist
> Subject: st: converting variable labels to proper case with 
> apostrophes
> 
> 
> I am trying to convert my variable labels to proper case, so that
> instead of "government office region" I have "Government Office
> Region". I used this code:
> 	foreach var of varlist _all {;
> 		set trace on;
> 		lab var `var' "`=proper("`:var label `var''")'";
> 	};
> 
> but it runs into problem when there are apostrophes in the label. I
> checked out the labutils suite, but I don't think there's a solution
> there.
> 
> Any suggestions?
> 
> Dimitriy Masterov
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index