Regular expression is used frequently nowadays. Stata's help file on regular expression, that is -regexm-, -regexr-, and -regexs- is too simple. Suppose there is a string variable which sotre letters & numbers, and some of letters is in lowercase. Now I want to uppercase them. Surely I can use string function -strupper()- to achieve that. And what's the regular expression equivalent to it?
Code:
. input str10 address address 1. abcd1010 2. BDTY0204 3. TWcb0203 4. jbtw0987 5. jbFL0105 6. xtbJ0108 7. end . generate address_upper=strupper(address) . list +---------------------+ | address addres~r | |---------------------| 1. | abcd1010 ABCD1010 | 2. | BDTY0204 BDTY0204 | 3. | TWcb0203 TWCB0203 | 4. | jbtw0987 JBTW0987 | 5. | jbFL0105 JBFL0105 | |---------------------| 6. | xtbJ0108 XTBJ0108 | +---------------------+
0 Response to Regular expression in Stata
Post a Comment