How to compute midpoint mean?

1     2     Edited Nov 14, 2015 by robsmith

One user asked: What's the best way to compute Means for age or income category questions? Do I create a recoded variable converting the categories into the midpoint values? Or do I do it using syntax in RB? (e.g., %($25K-$50K)*37.5))+ %($50K-$75K)*62.5.5))+…) Is there another method?

Another user asked: How can we do a grouped mean? For example, we have different age buckets but I would like to report out on the midpoint mean.


Comments

0

Anonymous Jan 4, 2015

User clarification: For example, if we have age groups of 20-29, 30-39, 40-49, etc., we often will report on the means. For example, we would recode all cases in the 20-29 group to 24.5, 30-39 group to 34.5, etc. Then do a mean of these. Does this make sense?

0

robsmith Jan 4, 2015

I think the syntax allows it now. But it's not easy: use the syntax: test_condition ? result_if_true : result_if_false which is similar to Excel's syntax if(test_condition, result_if_true, result_if_false).

For​ example:

avg( (q1>=20 and q1<=29) ? 24.5 : (q1>=30 and q1<=39) ? 34.5 : (q1>=40 and q1<=49) ? 44.5 : null )

Leave a Comment

Please sign in to leave a comment.