Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating the average with missing values using SAS

Tags:

sas

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.

like image 778
user9292 Avatar asked Sep 15 '25 13:09

user9292


1 Answers

Use the mean function:

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

or

average = mean(of x1-x4);
like image 185
itzy Avatar answered Sep 18 '25 10:09

itzy