Statalist


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

st: RE: St: variable editing


From   "Zhiqiang Wang" <[email protected]>
To   <[email protected]>
Subject   st: RE: St: variable editing
Date   Wed, 25 Jun 2008 11:17:05 +1000

There may be several quick solutions in Stata. The one I would use is
-egen, ends-. 

To use the following data: 
	var1
	Afghanistan	
 	Albania**	
	Armenia	
	Azerbaijan*	

. egen var2=ends(var1), head punct(*)
. list var1 var2

     +---------------------------+
     |        var1          var2 |
     |---------------------------|
  1. | Afghanistan   Afghanistan |
  2. |   Albania**       Albania |
  3. |     Armenia       Armenia |
  4. | Azerbaijan*    Azerbaijan |
     +---------------------------+

Hope this helps.  

Zhiqiang 

Zhiqiang Wang, PhD
School of Medicine, University of Queensland
Room 317, Edith Cavell Building
Royal Brisbane & Women's Hospital
Herston QLD 4029
Australia
Tel: +61 7 3346 4811
Fax: +61 7 3346 4812
Email: [email protected]

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Eric Uslaner
Sent: Wednesday, 25 June 2008 9:47 AM
To: [email protected]
Subject: st: St: variable editing

Greetings,

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.  Any help would be
greatly appreciated.

Thanks,

Ric Uslaner




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

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