converting string into numeric in runmlwin

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
ashish123
Posts: 9
Joined: Thu Mar 20, 2014 12:59 pm

converting string into numeric in runmlwin

Post 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.
ChrisCharlton
Posts: 1355
Joined: Mon Oct 19, 2009 10:34 am

Re: converting string into numeric in runmlwin

Post 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
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: converting string into numeric in runmlwin

Post 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
ashish123
Posts: 9
Joined: Thu Mar 20, 2014 12:59 pm

Re: converting string into numeric in runmlwin

Post by ashish123 »

Hi Chris and George,
It worked perfectly fine.Thanks for the help.
Post Reply