This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:create:functions:valuesum [24.01.2015 16:20] – [valueSum()] alexander.ritter | en:create:functions:valuesum [05.09.2023 23:11] (current) – swissel.uni-mannheim | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== valueSum() ====== | ====== valueSum() ====== | ||
- | '' | + | '' |
- | '' | + | '' |
- | '' | + | '' |
- | Calculates the sum of the answer codes for all items in a question (e.g. a scale), for selected items, or for a list of variables. | + | Calculates the sum of answer codes for all items of a question (e.g. a scale), for selected items or for a list of variables. |
- | * //question// -- ID of a question | + | * //Question// -- Die Kennung einer Frage (als String) |
- | * //items// -- A list (string or array) of items e.g. | + | * //Items// -- A list (string or array) of items, e.g. |
* '' | * '' | ||
+ | * '' | ||
* ''' | * ''' | ||
- | * //variables// -- A list (array) of variable | + | * //Variables// -- A list (array) of variable |
- | * '' | + | * '' |
+ | |||
+ | |||
+ | **Note:** The function '' | ||
===== Examples ===== | ===== Examples ===== | ||
- | Calculate | + | Calculate sum over all responses in scale AB01. |
<code php> | <code php> | ||
Line 24: | Line 28: | ||
</ | </ | ||
- | Sum of items 2, 4, 6 and 8 in scale AB01. | + | Sum over items 2, 4, 6, and 8 of the AB01 scale. |
<code php> | <code php> | ||
- | $sum = valueSum(' | + | $sum = valueSum(' |
</ | </ | ||
- | Sum of the first 4 items in scale AB01. | + | Sum over the first 4 items of the AB01 scale. |
<code php> | <code php> | ||
$sum = valueSum(' | $sum = valueSum(' | ||
</ | </ | ||
- | Sum of the responses in variables AB01_01, AB01_03 and BB01_02. | + | Sum over the responses in variables AB01_01, AB01_03, and BB01_02 |
<code php> | <code php> | ||
- | $sum = valueSum(array(' | + | $sum = valueSum([' |
</ | </ | ||
- | The same command | + | The same command |
<code php> | <code php> | ||
- | $sum = valueSum( | + | $sum = valueSum([ |
- | | + | |
' | ' | ||
' | ' | ||
' | ' | ||
- | ) | + | ]); |
- | ); | + | |
</ | </ |