Error message: invalid variable names

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
laura
Posts: 12
Joined: Wed May 18, 2011 2:37 pm

Error message: invalid variable names

Post by laura »

Hi,

I'm getting the following message when I use runmlwin:

"Some variables have names which are invalid in Stata, this may cause a problem when you load the data"

You can then click ok and the model runs fine, but each models causes this message to flash up.

The variable names were all generated in Stata and are fine, and the runmlwin script is not returning any new variables (e.g. no residual variables being returned). And we've run the do file before and not got this error message.

We just updated to v1.24 and are still getting the error.

Any ideas?!

Thanks,
Laura
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Error message: invalid variable names

Post by ChrisCharlton »

When MLwiN saves a Stata file it checks each variable that it is saving to make sure it's name is alphanumeric and doesn't start with a digit. It also checks that it isn't one of the following reserved variable names:

_all, _long, _N, in, _skip, _weight, _pred, _cons, float, _b, _n, pi, int, using, with, _rc, double, if, _coef

One way to find the cause of the problem is to add the option viewfullmacro to the end of your runmlwin command line and then look for lines that start with SSTA and contain variable names that break the above rules in the viewer window that is displayed.
laura
Posts: 12
Joined: Wed May 18, 2011 2:37 pm

Re: Error message: invalid variable names

Post by laura »

Thanks for these replies.

We have a variable named pi, so that must have been the problem. We will rename it!

Oddly, the error message comes up on my colleague's laptop, but not on my networked University of Bristol PC. So same data, same do file, runs fine on one but not the other. Something to do with the networked version of Stata???

Cheers,
Laura
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Error message: invalid variable names

Post by ChrisCharlton »

I have just checked the Stata manual and it turns out that a few of the reserved variable names that MLwiN checks for are wrong (for example it should check for _pi instead of pi). This will be fixed in the next release of MLwiN.
Post Reply