Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: string replacement


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: string replacement
Date   Tue, 20 Jan 2004 17:26:33 -0000

Try 

foreach var of varlist _all {
	local label: variable label `var'
 	local lnewlab: subinstr local label "`=char(96)'" "'", all
 	label variable `var' "`lnewlab'"
}

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of 
> Ulrich Kohler
> Sent: 20 January 2004 17:14
> To: [email protected]
> Subject: st: string replacement
> 
> 
> hi all,
> 
> I have a dataset were several variables labeled as follows:
> 
> "household`s equivalent income"
>          ^^^
> 
> Please note the sign before the s in household's. It is the 
> opening single 
> quotation mark, as it is used in Stata to mark local 
> macros, combound qoutes 
> etc. 
> 
> I like to change that sign into ', that is a closing single 
> qoutation mark. 
> The reason for this is, that it seems the fault of this 
> sign, that I get some 
> unexpected errors, i.e.
> 
> . lookfor xyz
> { required
> r(100);
> 
> 
> I tried:
> 
> foreach var of varlist _all {
> 	local label: variable label `var'
> 	local lnewlab: subinstr local label `"`"' `"'"', all
> 	label variable `var' "`lnewlab'"
> }
> 
> 
> But this don't work. What else could be done (excluding 
> retyping by hand).
> 
> Any ideas highly appreciated
> uli
> 
> 
> -- 
> [email protected]
> +49 (030) 25491-361
> 
> 
> *
> *   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