Suppose we have 20 subjects, and for each subject we have four variables: X1, X2, X3, and X4. I want to calculate the average for each subject, but the problem is whenever there is a missing value(s), SAS won't give the mean value. How can I do that while adjusting for n (if no missing value, n=4, if there is one missing values, then n=3, etc.) Thanks.

share|improve this question

1 Answer

up vote 3 down vote accepted

Use the mean function:

average = mean(x1,x2,x3,x4);

or

average = mean(of x1-x4);
share|improve this answer

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.