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

st: string replacement


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   st: string replacement
Date   Tue, 20 Jan 2004 18:13:33 +0100

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/



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