Calculating Avearge values

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Calculating Avearge values

Suppose we have the values for each of the 3 variables eg. Score_assignment, Score_quiz, Score_forum for a set of students. Now I want to get the average value for each of the student.  But for some students values of one or more variables are missing. Then we will calculate the average by using the following formula:

  1. Ex.

Student No.

Score_assignment

Score_quiz

Score_forum

Average

1

10

15

45

(10+15+45)/3

2

14

20

(14+20)/2

3

41

41/1

Please write down a sas code such that I can calculate the average value using the above logic.


Accepted Solutions
Solution
‎06-17-2013 04:35 AM
Contributor
Posts: 51

Re: Calculating Avearge values

Hi debdippal,

Average = mean(Score_assignment, Score_quiz, Score_forum);

View solution in original post


All Replies
Solution
‎06-17-2013 04:35 AM
Contributor
Posts: 51

Re: Calculating Avearge values

Hi debdippal,

Average = mean(Score_assignment, Score_quiz, Score_forum);

Super Contributor
Posts: 644

Re: Calculating Avearge values

vxhong17 is correct.  Read the documentation on the mean() function and you will see that it automatically omits missing values from its calculations.

Richard

New Contributor
Posts: 3

Re: Calculating Avearge values

Thanks

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 180 views
  • 0 likes
  • 3 in conversation