RealcomImputeLoad error with import of impvals file
Posted: Thu Jun 21, 2012 1:43 pm
Hi,
I'm having trouble with realcomImputeLoad.
The issue seems to be that Stata (using the realcomImputeLoad.ado) is not loading the impvals file in correctly - set trace shows this:
. realcomImputeLoad
------------------------------------------------------------------------------------------- begin realcomImputeLoad ---
- version 11.1
- syntax
- preserve
- quietly insheet using impvals.txt, clear
- local numimputations = v1[3]
v1 not found
--------------------------------------------------------------------------------------------- end realcomImputeLoad ---
r(111);
Examination of the impvals.txt file in Stata shows that it is reading in the variable names. This then means that v1 is no longer v1 but 'varname' and that row [3] is actually row [2].
I tried tinkering with a copy of the realcomImputeLoad.ado file, adding the 'nonames' option to the quietly insheet using impvals.txt, clear command. This worked in the sense that the first error was avoided, but the ado file then hung here instead:
. realcomImputeLoadJF
----------------------------------------------------------------------------------------- begin realcomImputeLoadJF ---
- version 11.1
- syntax
- preserve
- quietly insheet using impvals.txt, clear nonames
- local numimputations = v1[3]
- local i = 1
- local varname = v1 in 1
- while "`varname'"!="" {
= while "prepa1"!="" {
- local varname`i' `varname'
= local varname1 prepa1
- local i = `i' + 1
= local i = 1 + 1
- local varname = v`i' in 1
= local varname = v2 in 1
- }
- while "`varname'"!="" {
= while "prepa2"!="" {
- local varname`i' `varname'
= local varname2 prepa2
- local i = `i' + 1
= local i = 2 + 1
- local varname = v`i' in 1
= local varname = v3 in 1
- }
- while "`varname'"!="" {
******loop repeats for 21 response variables on first row of impvals
- while "`varname'"!="" {
= while "tenure"!="" {
- local varname`i' `varname'
= local varname20 tenure
- local i = `i' + 1
= local i = 20 + 1
- local varname = v`i' in 1
= local varname = v21 in 1
- }
- while "`varname'"!="" {
= while "singlepar"!="" {
- local varname`i' `varname'
= local varname21 singlepar
- local i = `i' + 1
= local i = 21 + 1
- local varname = v`i' in 1
= local varname = v22 in 1
v22 not found
}
------------------------------------------------------------------------------------------- end realcomImputeLoadJF ---
r(111);
At this point I got stuck as I'm not sure what the loop is doing (not sure what the 'in' means).
The interesting thing about all this is that it only seems to happen when there are more than 10 response variables in the impvals file (I tested this by removing the number of variable names). When there are less than 10, the nonames option is not needed and so the file runs fine.
I'd be grateful if you have any insights on this.
Best wishes
Jamie
I'm having trouble with realcomImputeLoad.
The issue seems to be that Stata (using the realcomImputeLoad.ado) is not loading the impvals file in correctly - set trace shows this:
. realcomImputeLoad
------------------------------------------------------------------------------------------- begin realcomImputeLoad ---
- version 11.1
- syntax
- preserve
- quietly insheet using impvals.txt, clear
- local numimputations = v1[3]
v1 not found
--------------------------------------------------------------------------------------------- end realcomImputeLoad ---
r(111);
Examination of the impvals.txt file in Stata shows that it is reading in the variable names. This then means that v1 is no longer v1 but 'varname' and that row [3] is actually row [2].
I tried tinkering with a copy of the realcomImputeLoad.ado file, adding the 'nonames' option to the quietly insheet using impvals.txt, clear command. This worked in the sense that the first error was avoided, but the ado file then hung here instead:
. realcomImputeLoadJF
----------------------------------------------------------------------------------------- begin realcomImputeLoadJF ---
- version 11.1
- syntax
- preserve
- quietly insheet using impvals.txt, clear nonames
- local numimputations = v1[3]
- local i = 1
- local varname = v1 in 1
- while "`varname'"!="" {
= while "prepa1"!="" {
- local varname`i' `varname'
= local varname1 prepa1
- local i = `i' + 1
= local i = 1 + 1
- local varname = v`i' in 1
= local varname = v2 in 1
- }
- while "`varname'"!="" {
= while "prepa2"!="" {
- local varname`i' `varname'
= local varname2 prepa2
- local i = `i' + 1
= local i = 2 + 1
- local varname = v`i' in 1
= local varname = v3 in 1
- }
- while "`varname'"!="" {
******loop repeats for 21 response variables on first row of impvals
- while "`varname'"!="" {
= while "tenure"!="" {
- local varname`i' `varname'
= local varname20 tenure
- local i = `i' + 1
= local i = 20 + 1
- local varname = v`i' in 1
= local varname = v21 in 1
- }
- while "`varname'"!="" {
= while "singlepar"!="" {
- local varname`i' `varname'
= local varname21 singlepar
- local i = `i' + 1
= local i = 21 + 1
- local varname = v`i' in 1
= local varname = v22 in 1
v22 not found
}
------------------------------------------------------------------------------------------- end realcomImputeLoadJF ---
r(111);
At this point I got stuck as I'm not sure what the loop is doing (not sure what the 'in' means).
The interesting thing about all this is that it only seems to happen when there are more than 10 response variables in the impvals file (I tested this by removing the number of variable names). When there are less than 10, the nonames option is not needed and so the file runs fine.
I'd be grateful if you have any insights on this.
Best wishes
Jamie