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   Sat, 24 Sep 2011 16:14:29 +0100

This appears to refer to values in a string variable. I would

. replace countryname = subinstr(countryname, char(34), "", .)

. di char(34)

would show that char(34) is the double quotation mark " which is what
you want to remove.

The number of quotation marks is not an issue.

If delimiting quotation marks always occurred, then

. replace countryname = substr(countryname, 2, length(countryname) - 2)

would be another solution, but the first solution appeals to me more.


On Sat, Sep 24, 2011 at 4:06 PM, Eric Uslaner <[email protected]> wrote:

> 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.

*   For searches and help try:

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