Variable not allowed

Welcome to the forum for REALCOM users. Feel free to post your question about REALCOM 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 REALCOM (Developing multilevel models for REAListically COMplex social science data) >> http://www.bristol.ac.uk/cmm/software/realcom/
Post Reply
Jamoo
Posts: 36
Joined: Wed Oct 05, 2011 2:33 pm

Variable not allowed

Post by Jamoo »

Hi there,

Using realcomimputeLoad, I get the following error (see snippet from the command after set trace was set to on). Specifically, the second variable preemo listed in the impvals file (file copied in below the error as couldn't attach it) was not allowed.

Has anyone seen this before?

Thanks

Jamie

***************error snippet begins*********
------------------------------------------------ end reshape.Macdrop ---
- exit _rc
---------------------------------------------------- end reshape.DoNew ---
- exit
------------------------------------------------------------ end reshape ---
- quietly forvalues i=1(1)`numimputations' {
= quietly forvalues i=1(1)4 {
- local filename`i' = v in `i'
= local filename1 = v in 1
- }
- local filename`i' = v in `i'
= local filename2 = v in 2
- }
- local filename`i' = v in `i'
= local filename3 = v in 3
- }
- local filename`i' = v in `i'
= local filename4 = v in 4
- }
- quietly forvalues i=1(1)`numimputations' {
= quietly forvalues i=1(1)4 {
- insheet using "`filename`i''.", tab clear nonames
= insheet using "imputeiter250.", tab clear nonames
- forvalues j=1(1)`numimputedvars' {
= forvalues j=1(1)1 {
- rename v`j' `varname`j''`i'
= rename v1 bmi2c preemo postemo prehyper posthyper prepeer postpeer prepro po
> stpro preser postser prediet postdiet prepa postpa pcsessions ethnic tenure s
> inglepar empstat1
preemo not allowed
}
save imp`i', replace
}
---------------------------------------------------- end realcomImputeLoad ---
r(101);

end of do-file

r(101);

********error snippet ends*********

**********impvals was as follows**********************

bmi2c preemo postemo prehyper posthyper prepeer postpeer prepro postpro preser postser prediet postdiet prepa postpa pcsessions ethnic tenure singlepar empstat
13350
4
imputeiter250 imputeiter500 imputeiter750 imputeiter1000
ChrisCharlton
Posts: 1252
Joined: Mon Oct 19, 2009 10:34 am

Re: Variable not allowed

Post by ChrisCharlton »

It looks as if insheet is reading all the variable names into one variable instead of creating one for each. This means that rename is attempting to rename the variable v1 to the whole list of names in your data. You should be able to confirm this with the command:

Code: Select all

insheet using impvals.txt, clear nonames
and then browsing the loaded data.

If this is the case you will need to either modify impvals.txt so that insheet understands it or change the insheet command at the beginning of realcomImputeLoad so that it is able to correctly interpret the file.
Jamoo
Posts: 36
Joined: Wed Oct 05, 2011 2:33 pm

Re: Variable not allowed

Post by Jamoo »

Hi Chris,

Many thanks. It was the impvals file not being tab delimited.

Best wishes

Jamie
Post Reply