Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Removing space from string variable
From
Mike Kim <[email protected]>
To
[email protected]
Subject
st: Removing space from string variable
Date
Thu, 12 Apr 2012 17:08:55 -0500
Hi all,
I have a question about removing leading and trailing spaces.
I imported excel file:
import excel using “myfile.xlsx”, first clear
Some observations of the variable “brand” have leading or trailing
spaces. Stata reads some spaces as spaces. In this case I can remove
spaces using:
replace brand=trim(brand)
The problem is that Stata reads some spaces as “?”. In this case, trim
does not work. More strange thing is that on screen of data editor,
Stata shows “?” like the following, but if I double click, neither a
space or “?” is not there. Stata still recognize the two as different
observations.
Mercedes
Mercedes?
How can I remove “?” and make them as the same observations?
Thank you.
Mike.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/