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

From |
Matthew Hamilton <mwhamilton@gmail.com> |

To |
Statalist <statalist@hsphsun2.harvard.edu> |

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: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: Re: replace if and too many literals error***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**st: Upcoming NetCourses** - Next by Date:
**Re: st: Increasing variance of dependent variable, logit, inter-rater agreement** - Previous by thread:
**st: Upcoming NetCourses** - Next by thread:
**st: Re: replace if and too many literals error** - Index(es):

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