## create a score from multiple variables

Solved
Regular Contributor
Posts: 150

# create a score from multiple variables

I have 5 binary yes/no variables that assess knowledge. I want to combine those 5 variables to indicate if they answered the questions correctly. What is the best way to do this, so for instance.

If they answered all 5 correct then their score would be 5, if they answered 4 then it would be 4, and so on...the score can be any combination of correct answers. Any help is greatly appreciated.

Accepted Solutions
Solution
‎09-18-2014 07:07 PM
Super User
Posts: 23,754

## Re: create a score from multiple variables

new_variable=sum(var1, var2, var3, var4, var5);

All Replies
Posts: 1,270

## Re: create a score from multiple variables

How you determine whether the awnswer is correct or not?

Regular Contributor
Posts: 150

## Re: create a score from multiple variables

I have made it so the correct answer is always equal to 1 for ease.

Solution
‎09-18-2014 07:07 PM
Super User
Posts: 23,754

## Re: create a score from multiple variables

new_variable=sum(var1, var2, var3, var4, var5);

Regular Contributor
Posts: 150

## Re: create a score from multiple variables

That works, that just seemed too simple I guess. Thank you for your help.

🔒 This topic is solved and locked.