Page 1 of 1

average of variables in specific level

Posted: Mon May 27, 2013 11:05 am
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

Re: average of variables in specific level

Posted: Wed May 29, 2013 9:39 am
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.