Error code - Duplicate column name

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
mariemurphy
Posts: 6
Joined: Sat Jan 07, 2017 7:23 pm

Error code - Duplicate column name

Post by mariemurphy »

Hello,

I am trying to run the following model in Stata v13 and MLWiN 2.36:

**CC Model 4 - Interaction effect
runmlwin BMI_z cons i.Ethnicity_NHS_code_11_groups ///
Sex_code Year_code ///
Schl_IMD_decile BME KS2 ///
Child_IMD_decile ///
i.Ethnicity_NHS_code_11_groups#Sex_code, ///
level3(school: cons) ///
level2(neigh: cons) ///
level1(student: cons) ///
nopause

runmlwin BMI_z cons i.Ethnicity_NHS_code_11_groups ///
Sex_code Year_code ///
Schl_IMD_decile BME KS2 ///
Child_IMD_decile ///
i.Ethnicity_NHS_code_11_groups#Sex_code, ///
level3(school: cons) ///
level2(neigh: cons) ///
level1(student: cons) ///
mcmc(cc) initsprevious ///
nopause

MLWiN appears to complete the equation fine but I think it is having problems storing it, since I get an error message about a Duplicate column name (see attachment). Does anyone know what I might be doing wrong or how I can fix this please?

Thanks in advance for your help.

Best wishes,
Marie
ChrisCharlton
Posts: 1354
Joined: Mon Oct 19, 2009 10:34 am

Re: Error code - Duplicate column name

Post by ChrisCharlton »

The attachment doesn't appear to be present. Does the message indicate which column it is referring to? If not then it may be worth turning nopause off and seeing whether you get anything more informative via the GUI.
mariemurphy
Posts: 6
Joined: Sat Jan 07, 2017 7:23 pm

Re: Error code - Duplicate column name

Post by mariemurphy »

Thanks Chris. Sorry about the missing attachment. The error message states:

Error while obeying batch fie
C:\Users\cvmar341\AppData\Local\Temp\ST_06000008.tmp at line number 1504: NAME C1489] 'FP1__2_Ethnicity_NHS_code_11_gro'
Duplicate file name

I have tried running with no pause - the Names window shows indeed a duplicate name at C1472, which I figure is from the inclusion of Ethnicity as an earlier covariate - am I right in thinking that it is probably a case of the variable name being too long that MLWiN is not able to distinguish between each of my ethnicity categories and each ethnicity category interacted with sex?

Best wishes,
Marie
ChrisCharlton
Posts: 1354
Joined: Mon Oct 19, 2009 10:34 am

Re: Error code - Duplicate column name

Post by ChrisCharlton »

MLwiN does not have a limit on the length of variable names, however as the MCMC parameter chains need to be saved as a Stata dta file, which has a 32 character limit (see http://www.stata.com/help.cgi?limits) they have to be named to accommodate this. Assuming that you are using version 11 or later of Stata the corresponding line for the fixed part parameter chains is:

Code: Select all

file write `macro2' "NAME   G21[`i'] '`=strtoname("`var'")''" _n
This uses the Stata strtoname function (see http://www.stata.com/help.cgi?strtoname), which replaces characters in the name that are invalid for Stata, and truncates it to 32 characters if this length would otherwise be exceeded. This code does not however check whether more than one parameter chain name would end up with the same name, so that the situation you describe can occur if this is the case.

The workaround, as I think you are suggesting, is to reduce the length of your category names so that they are short enough to be used or to make sure that the portion that is left after truncation is unique.
mariemurphy
Posts: 6
Joined: Sat Jan 07, 2017 7:23 pm

Re: Error code - Duplicate column name

Post by mariemurphy »

Success! Thanks for your help Chris, much appreciated
Post Reply