Here's a simple problem I bet many novices like me have encountered. I
want to standardize the values of a string variable in my data called
"labtest." The approach I'm taking is this:
replace labtest="string_standard" if strmatch(labtest,"string_1") |
strmatch(labtest,"string_2") | ... | strmatch(labtest,"string_N")
Where strings 1 through N are unwanted variants of the standard string
I'm trying to impose. When N (the number of logical conditions above)
is larger than 13, I get the error message "too many literals." But
the system limit for number of string literals in an expression is
512, and the limit for numeric literals is supposed to be 300. (For my
version, IC v10.) Both limits are much larger than 13.
1. What's the problem?
2. Is there a more elegant way to standardize messy string variables?
(Mine are write-in responses from a survey.)
Thanks for your consideration.
*
* 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/