Good. Another solution appears to be
to escape the usual interpretation of `
with a backslash:
: subinstr local label "\`" "'", all
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> Ulrich Kohler
> Sent: 20 January 2004 17:39
> To: [email protected]
> Subject: Re: st: RE: string replacement
>
>
> Yes, it works. Thanks a lot!
> uli
>
> Nick Cox wrote:
> > 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/
>
> --
> [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/