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]
Re: st: Removing space from string variable
From 
 
Eric Booth <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: Removing space from string variable 
Date 
 
Thu, 12 Apr 2012 17:25:36 -0500 
<>
In addition, look at -charlist- from SSC to look at these characters.  There was a related issue/question posted earlier today:
http://www.stata.com/statalist/archive/2012-04/msg00528.html
- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
On Apr 12, 2012, at 5:16 PM, Dimitriy V. Masterov wrote:
> Mike,
> 
> You might be able to see what the weird characters are using hexdump
> with the analyze option, and remove them with the filefilter command.
> However, you might have to save the excel file as csv or txt file
> first.
> 
> DVM
> 
> On Thu, Apr 12, 2012 at 6:08 PM, Mike Kim <[email protected]> wrote:
>> 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/
> 
> *
> *   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/
*
*   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/