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, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Replacing certain characters in variable labels.

From   Anna Reimondos <>
Subject   st: Replacing certain characters in variable labels.
Date   Fri, 9 Apr 2010 11:49:54 +1000

I am currently cleaning a dataset but am having some trouble with the
variable labels. The variable labels are related to the wording of the
actual question in the survey.
For example for the first variable the variable name should   "A
woman's job is to stay at home?"

However whenever apostrophes are displayed strangely so that in the
dataset the name looks like "A woman’s job is to stay at home?".

What I would like to do is to replace all occurrences of "’" with an
apostrophe instead " ' ".

I attempted to do this but it did not work and I am not really sure
what I am doing...

foreach i of varlist _all {
local a: variable label `i'
local a: subinstr("`a'","’","'",.)
label var `i' "`a'"

Any help or tips would be much appreciated.

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index