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

st: RE: ST: variable editing

From   "Nick Cox" <>
To   <>
Subject   st: RE: ST: variable editing
Date   Wed, 25 Jun 2008 17:20:20 +0100

Not so. Friedrich's solution was 

. replace country = subinstr(country,"*","",.)


. replace country = subinstr(country,"*"," ",.)

Of course, there may have been a trailing blank to start with. 

In either case, as Bret points out -trim()- would take care of any
(leading or) trailing blanks. 

More generally, what one function doesn't do is often solved by another.


Eric Uslaner

Thanks Mike, Zhiqiang, and Friedrich for your help.  One other issue.
On either Zhiqiang's or Friedrich's solutions, the result for country
names with one or two asterisks is to delete the asterisks (as desired,
thanks), but to leave a trailing blank, so that:




where _ is not an underscore but simply a left-shifted blank that is not
the same as:


in another data set that I want to merge with this data set.

So when I do

mmerge country using otherdataset

and then sort _merge and clist _merge country

I get Albania in one data set and Albania_ in the second data set, with
the merged data set now having both, while they should be matched.  Any
help would be appreciated.

*   For searches and help try:

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