Page 1 of 1

converting string into numeric in runmlwin

Posted: Thu Sep 11, 2014 7:25 am
by ashish123
Hello,
I am running two level model in runmlwin:

Code: Select all

. runmlwin censor cons, ///
    level2(jik2: cons) ///
    level1(jik:) ///
    discrete(distribution(binomial) link(logit)denominator(cons) pql2) ///
    nogroup maxiterations(1000) mlwinsettings(optimat)
For quick scanning of data i have converted the two identifiers(jik &jik2) into numeric type using destring command
error is coming

"jik is held to more precision than MLwiN can handle, to reduce the precision use recast float jik, force"
after recasting jik (individual identifier), it is not uniquely identifying the observations

Code: Select all

. isid jik
"variable jik does not uniquely identify the observations"

Any help regarding this will be helpful.Hoping for quick response.

Re: converting string into numeric in runmlwin

Posted: Thu Sep 11, 2014 3:52 pm
by ChrisCharlton
To determine the cause of this you would need to provide examples of the structure of the jik variable (e.g. do they have leading zeros?, maximum number of digits, range of values, whether they are unique prior to destring, etc). Assuming that you don't need to link the ids back after estimation it may be easier to just generate a new version with the correct properties, i.e.

Code: Select all

gen ijk = _n

Re: converting string into numeric in runmlwin

Posted: Thu Sep 11, 2014 4:04 pm
by GeorgeLeckie
Hi Ashish,

Yes I would do as Chris suggests

Code: Select all

. generate newjik = _n
If you also need to generate a new level-2 ID then you can use the following command

Code: Select all

. egen newjik2 = group(jik2)
Best wishes

George

Re: converting string into numeric in runmlwin

Posted: Sun Sep 14, 2014 4:54 am
by ashish123
Hi Chris and George,
It worked perfectly fine.Thanks for the help.