Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Re: string functions quotation marks

From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Re: string functions quotation marks
Date   Wed, 28 Sep 2011 11:02:25 +0100

This possibility was addressed in

from which a solution for removing first and last characters that are
quotation marks is (with your variable name)

 replace country = substr(country, 2, length(country) - 2)

Eric or Ric didn't reply to the list, so we presume that he is content somehow.


On Wed, Sep 28, 2011 at 10:25 AM, Oliver Jones
<[email protected]> wrote:
> Hi, can you get rid of the first quotation mark by
> replace country = substr(country, 2, .)
> where I assume that the variable holding your country names is called
> country?
> If yes, than you can figure out how to get rid of the last one by first
> finding out the length of the string...
> If this just cuts of the first letter of the country name then the string
> doesn't actually contain any quotation marks. They are probably just
> displayed because of thats the way Stata displays string variables.
> Best
> Oliver
> Am 24.09.2011 17:06, schrieb Eric Uslaner:
>> Greetings,
>> I have a dataset (obviously not my own) in which the names of countries
>> are all in quotation marks.  I need to get rid of the quotation marks to
>> merge this dataset with another.  However, the situation is somewhat
>> complicated.  Country names may have one word (e.g., "Canada" or "Yemen"),
>> two words ("North Korea" is one example), three words ("United States of
>> America" or "Yemen Arab Republic"), or more ("Democratic Republic of the
>> Congo").  Is there a way to get rid of these quotation marks?  I have read
>> the manual and looked at help from within Stata and can't find a solution.
>> Thanks for any help,

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index