Dear statalist
I wonder whether can code a large set of if conditions in Mata, for example:
Maybe there are 5000 or more if conditions, I know this can be down by "merge" in stata, just want to know how to code this via mata without a data file, a simple test shows the error message "too may string literals".
I wonder whether can code a large set of if conditions in Mata, for example:
Code:
void function tmp(string scalar vname, string scalar nvname)
{
string matrix s, ns
real scalar i
st_sview(s,.,vname)
st_sview(s,.,nvname)
for (i=1;i<=row(s);i++) {
if (s[i,.] == "a") ns[i,.] = "b"
if (s[i,.] == "e") ns[i,.] = "d"
if ...
if ...
if ...
...
}
}
