Dear List
I’d appreciate help using strip (from http://fmwww.bc.edu/RePEc/bocode/s in Stata13.1 64bit) to define more than a letter (if it is possible). I think my problem is I’m not fully competent yet defining character/apostrophe combinations.
I have a list of names followed by (x) (where x is one of the 26 capital letters). When I run the code below it removes all capitals but I only want to loop through and remove the full "(x)".
Examples:
Albany (A)
Bathurst Region (B)
Blue Mountains (R)
I want to end up with:
Albany
Bathurst Region
Blue Mountains
(There are also places with, eg, ...(DC) etc. I'll deal with these if I get the basic code to work.)
I have tried the code below but am stripping all capital letters from the data. I have tried various combinations of ` ' " but have not hit the right one by trial-and-error:
Any help appreciated.
Laurence
I’d appreciate help using strip (from http://fmwww.bc.edu/RePEc/bocode/s in Stata13.1 64bit) to define more than a letter (if it is possible). I think my problem is I’m not fully competent yet defining character/apostrophe combinations.
I have a list of names followed by (x) (where x is one of the 26 capital letters). When I run the code below it removes all capitals but I only want to loop through and remove the full "(x)".
Examples:
Albany (A)
Bathurst Region (B)
Blue Mountains (R)
I want to end up with:
Albany
Bathurst Region
Blue Mountains
(There are also places with, eg, ...(DC) etc. I'll deal with these if I get the basic code to work.)
I have tried the code below but am stripping all capital letters from the data. I have tried various combinations of ` ' " but have not hit the right one by trial-and-error:
Code:
foreach char in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z { strip lgatemp, of("(`char')") gen(outtemp) drop lgatemp rename outtemp lgatemp }
Laurence
Comment