If all of your strings are literally "(" + "name" + ")" with no spaces
at beginning or end, then, assuming that country is defined as str20 ...
gen str20 new = substr(country, 2, strlen(country) - 2)
-ml
qingf wang wrote:
If I have "(...)" in a variable, how to remove it? Thanks a lot!
Example:
country new
(germany) germany
(USA) usa
(India) India
*
* 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/
--
Michael I. Lichter, Ph.D. <[email protected]>
Research Assistant Professor & NRSA Fellow
UB Department of Family Medicine / Primary Care Research Institute
UB Clinical Center, 462 Grider Street, Buffalo, NY 14215
Office: CC 125 / Phone: 716-898-4751 / FAX: 716-898-3536
*
* 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/