Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Calculating a new variable based on items

How can I calculate a new variable based on the answers I have collected in SSI Web CBC module? For instance, I have 5 questions about the attitude to the environment and need to calculate the general attitude (average of these 5 items).
asked Dec 11, 2012 by anonymous

2 Answers

0 votes
If they are five radio or numeric questions then you can calculate the average using SSI Script

[% (Q1 + Q2 + Q3 + Q4 + Q5)/5 %]

You can then save it as the value of a hidden variable in a free format question. You can see some examples of hidden variables here: https://www.sawtoothsoftware.com/support/issues/ssiweb/online_help/index.html?hid_web_free_hidden.htm.
answered Dec 11, 2012 by Jeff Forkner Bronze (2,875 points)
0 votes
I assume you're referring to non-CBC questions here, such as numerics, select-type questions, or grids.

You could create a new variable within a Free Format question, and make it a "hidden" type variable.  Then, when you set its value (within the HTML script), you can include some SSI Script (script enclosed within [% and %] brackets).  Within those brackets you may refer to variables and use parentheses and addition and division operations.
answered Dec 11, 2012 by Bryan Orme Platinum Sawtooth Software, Inc. (154,105 points)