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


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

Re: st: Re: string functions quotation marks


From   Oliver Jones <ojones@wiwi.uni-bielefeld.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: string functions quotation marks
Date   Wed, 28 Sep 2011 11:25:21 +0200

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,

Ric




*
*   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/

--
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- -
Bielefeld University
Faculty of Business Administration and Economics
Chair of Econometrics and Statistics
- -
Raum / room:  V9-110
Tel / phone:  +49 (0)521 106 4871
- -
http://www.wiwi.uni-bielefeld.de/oekonometrie.html
---
*
*   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/


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