[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: replace if and too many literals error

From   Matthew Hamilton <>
To   Statalist <>
Subject   st: replace if and too many literals error
Date   Fri, 27 Feb 2009 15:41:51 -0800

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:

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