average of variables in specific level

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
Katerinaki
Posts: 11
Joined: Tue May 14, 2013 5:09 pm

average of variables in specific level

Post by Katerinaki »

Hi everybody

I got another question?

I am trying to find the average of categorical variables in specific level (eg country or class). If the categories of variables are two then its ok cause the percentage is easy to found because one of the caegory is 0 and so we gor the second one. My problem is when I have variable with more than two categories how can handle with this and check the average?
What I have done is:
I was going to Multilevel Data manipulation and I used the function average, the level for example class, and input->the old variable and output->the new average variable.....If this is correct should I make the new average variable into categoric or I want it to be continuous. Is this correct?

Thanks in advance for your help
Katerina
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: average of variables in specific level

Post by ChrisCharlton »

You can use the same method as you used for variable with two categories if you first convert the categorical variable into a series of dummies. You can do this via the DUMMy command, for example if you had a categorical variable called schgend with three categories you would do something like:

Code: Select all

DUMMy 'schgend' c11-c13
c11 would then contain a zero/one variable to say whether each row was in the first category, likewise c12 for the second category and c13 for the third category.

Once you have these new columns you can use the same method as before to calculate the percentages for each category.
Post Reply