Getting data in and out

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software 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!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
MLwiN-User
Posts: 19
Joined: Thu Sep 03, 2009 1:39 pm

Getting data in and out

Post by MLwiN-User »

How do I get data in or out of MLwiN?
MLwiN-Support
Posts: 16
Joined: Tue Oct 13, 2009 9:36 am

Re: Getting data in and out

Post by MLwiN-Support »

There are some step by step instructions here -

getting data IN http://www.cmm.bristol.ac.uk/MLwiN/tech ... ndex.shtml

getting data OUT: http://www.cmm.bristol.ac.uk/MLwiN/tech ... -out.shtml
MLwiN-User
Posts: 19
Joined: Thu Sep 03, 2009 1:39 pm

Re: Getting data in and out

Post by MLwiN-User »

I'm attempting to open a new worksheet directly from .dta (STATA) format and I get the error message "Duplicate name(RSTA)."
MLwiN-Support
Posts: 16
Joined: Tue Oct 13, 2009 9:36 am

Re: Getting data in and out

Post by MLwiN-Support »

This error message will be produced if there are two variables with the same name in the Stata file you are trying to open. Note that MLwiN does not distinguish between small and capital letters, so for example variable1, Variable1 and VARIABLE1 will all be considered the same name. Inside Stata, change the names of any variables that MLwiN would consider to be the same, save your worksheet and try importing into MLwiN again.
MLwiN-User
Posts: 19
Joined: Thu Sep 03, 2009 1:39 pm

Re: Getting data in and out

Post by MLwiN-User »

Is it possible that MLwiN has problems reading underscores ("__")? For example, reading ___ABC the same as ABC ?
MLwiN-Support
Posts: 16
Joined: Tue Oct 13, 2009 9:36 am

Re: Getting data in and out

Post by MLwiN-Support »

No, MLwiN should count '__ABC' and 'ABC' as different. To test whether MLwiN considers 2 names to be the same, open MLwiN without opening any worksheet (you can do this via the Programs menu, via a shortcut, or by clicking on MLwiN in its folder in your Program files, or alternatively you can double click on an MLwiN worksheet to bring MLwiN up and then select New worksheet from the File menu to close the worksheet). From the Data manipulation menu select Names. In the window that appears, highlight any row and click the Edit name button. Type in one of the names you want to test. Highlight a different row, press the Edit name button again and type in the other name. If MLwiN considers these 2 names the same you will get an error message saying 'duplicate name(NAME)' (confusingly when you press OK it appears that the variable has been given the name you chose in spite of the error message, but if you press the refresh button in the top left corner of the Names window you will see that in fact the variable has reverted to its previous name). If MLwiN considers the names to be different you will get no error message. You can delete the variables (highlight the rows and press the Delete button at the top of the Names window) and test another pair of names, or you can leave the variables and name more variables one at a time to test whether a name is the same as any that you have already used.
MLwiN-User
Posts: 19
Joined: Thu Sep 03, 2009 1:39 pm

Re: Getting data in and out

Post by MLwiN-User »

I'm trying to export data sets from MLwiN into files that have an ASCII file format (or .csv or SPSS data files). Selecting the ASCII text file output from the File menu command allows me to specify a column range c1-c10 and an output file name (and destination). But the resultant text file has the first 5 variables. I'm not sure what happened to the remaining 5 variables? Even entering in the variables separately c1 c2 c3 c4 c5 c6 … did not yield any better results. I have tried this process across several data files and on numerous occasions.
MLwiN-Support
Posts: 16
Joined: Tue Oct 13, 2009 9:36 am

Re: Getting data in and out

Post by MLwiN-Support »

Although it appears that only 5 variables are being exported when you use the ASCII text file output window from the File menu, in fact all 10 are exported. However you only see 5 columns of data because when you export more than 5 columns MLwiN wraps the data - see section 2 of Getting data out of MLwiN (http://www.cmm.bristol.ac.uk/MLwiN/tech ... html#over5) . So if you export the 10 variables in the tutorial dataset supplied with MLwiN, for example, then in the exported data the first number in your first column of data is the first entry of the variable school but the second number in your first column of data is the first entry of the variable girl. The third number in your first column is the second entry of school and the fourth number is the second entry of girl and so on. This wrapping is less obvious in the case when the number of variables you export is a multiple of 5 than it is in the example given in the Getting data out of MLwiN page because when the number of variables is a multiple of 5, there will be no gaps in the five columns of output data.

There are two solutions to this problem. The simplest is to upgrade from MLwiN 2.02 to MLwiN 2. (free to anyone who already has a copy of MLwiN 2.02: http://www.cmm.bristol.ac.uk/MLwiN/down ... ades.shtml). You may find when using this version that you get 10 columns of data when using the ASCII text file output window to output 10 variables, i.e. MLwiN is no longer wrapping output data when outputting more than 5 variables. But in any case there are easier ways to output from this version, which are described in the section Getting data out of MLwiN 2.1. (http://www.cmm.bristol.ac.uk/MLwiN/tech ... shtml#beta) Alternatively, if you do not wish to upgrade, the other solution is to follow the advice in section 2 of Getting data out of MLwiN (http://www.cmm.bristol.ac.uk/MLwiN/tech ... html#over5) - export five variables at a time into Excel where you can put them together again into a worksheet.
Post Reply