Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: St: variable editing


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: St: variable editing
Date   Wed, 25 Jun 2008 15:03:00 +0100

Among other solutions, Friedrich Huebler has already suggested
-subinstr()-, which is what occurred to me too. 

Michael's approach works and if you have MS Word and Excel on your
computer -- which is not automatic for Stata users -- it may even be
quicker than rummaging around in the Stata manuals or on-line to find a
solution. Nevertheless it is pretty indirect compared with use of string
functions. 

At some point it is a good idea for those who use Stata a lot just to
browse through the list of functions and see what they are missing. 

Nick 
[email protected] 

Michael McCulloch

Don't know how to do this in Stata, but one approach would be:
1. export from Stata to a text file
2. open with MS WORD, and remove the asterisks doing a global
Find-and-Replace,
3. copy and paste from WORD to EXCEL,
4. save as *.csv
5. re-importing the data using infile or insheet.

Ric Uslaner

>I have several data sets (from the World Bank Governance indicators) 
>where the names of countries sometimes have one or two asterisks 
>following their names, e.g.:
>
>Afghanistan
>Albania**
>Armenia
>Azerbaijan*
>
>etc.  I want to get rid of the asterisks to merge them with a master 
>data set.  Aside from editing each name individually, I presume that 
>there is an easier way that I just don't know.  


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index