SoSci Survey provides different question types for implementing rating scales. The following describes rating scales in which an item text (e.g., a statement) is shown on one side and several response levels for rating the item are shown next to it (or below it).
Depending on whether you would like to label only the extreme values of the scale or each individual value, please use the question type “Scale (extremes labelled)” or “Scale (fully labeled)”. You can also change the question type later on.
Tip: Under Layout → Arrangement, select whether the scale points shall be displayed next to the item text or below it.
The options of a scale automatically receive the codes 1 (minimum) to k (maximum), with k being the number of scale levels. E.g., 1 to 5 for a 5-point scale.
You can invert the coding of individual items (reversed coding), so that selecting the minimum (e.g., “does not apply at all”) does not receive the code 1, but the code 5 (on a 5-point scale). To do so, either check the box to the right of the item text (⮀) in the item quick entry, or select the item in the navigation on the left (List of Questions) and enable the option Invert answer codes for this item.
If you need a different coding (e.g., 0..4 instead of 1..5), you have two options: You can recode the items in the classic way during the data analysis – or you can recode them into new variables within the questionnaire.
For the latter, you first need a question Internal Variables with as many variables as your scale has items. The easiest way to achieve this is to duplicate the question with the scale and then change the question type of the copy to “Internal Variables”.
Then use PHP code and the function value() to read the respondent's answer in the scale, perform the desired recoding, and store the result in one of the internal variables by means of put().
Important: The PHP code must not be placed on the same page as the scale, but on the next page (e.g., right at the beginning of the following page). For details, please refer to the notes on the function value().
Note: If you would like to “reverse” individual, negatively worded items of the scale, please check the box for “Invert answer codes” for the respective item.
The following PHP code recodes all items of the scale “SC01” so that the coding 1..5 is transformed into 0..4. The recoded values are stored in the internal variables of “IV01”.
$input = 'SC01'; $output = 'IV01'; // Create a list of all items $items = getItems($input, 'all'); // Go through all items foreach ($items as $item) { // id() builds an item ID (SC01_01) from a question ID (SC01) and the item number (e.g., 1) // value() reads the answer code $orgCode = value(id($input, $item)); // Only recode positive codes if ($orgCode > 0) { // Subtract 1 $newCode = $orgCode - 1; } else { // Keep error codes $newCode = $orgCode; } // put() stores the value in an internal variable put(id($output, $item), $newCode); }
Important: The question “internal variables”, IV01 in the example, must be created manually in the list of questions (see above).
Important: The above code also transforms error codes, e.g., -1 for selecting a residual option (“don't know”) becomes -2. Code -9 (no answer) would become -10.
The following PHP code performs an individual recoding for each item. This recoding is defined in an array at the beginning. The ID of the item is used as key for the array, i.e., e.g., 2 for “SC01_02”.
Within the array, further arrays are defined (one per line in the example), which specify the exact recoding. For the second item, for example, the value 1 shall become 5, the values 2 and 3 become 2, the value 4 becomes 1, and the 5 becomes 0.
$input = 'SC01'; // ID of the scale question $output = 'IV01'; // ID of the internal variables $recode = array( 1 => array(1 => 2, 2 => 4, 3 => 6, 4 => 8, 5 => 10), 2 => array(1 => 5, 2 => 2, 3 => 2, 4 => 1, 5 => 0), 3 => array(1 => 1, 2 => 1, 3 => 2, 4 => 2, 5 => 4), 4 => array(1 => 0, 2 => 2, 3 => 2, 4 => 1, 5 => 0) ); foreach ($recode as $item => $codes) { // Retrieve the answer code from the scale $response = value(id($input, $item)); // Only recode if this value has been defined (otherwise store the error code -8) if (isset($codes[$response])) { put(id($output, $item), $codes[$response]); } else { put(id($output, $item), -8); } }
On mobile devices, SoSci Survey by default does not display the small checkboxes for fully labeled scales, but large boxes that are easy to hit with a finger.
On very small displays, the response options are then arranged vertically. In doing so – as known from volume controls – the highest value is placed at the top and the lowest at the bottom. If you prefer to arrange the options from bottom to top, adjust this in the question under More Settings → Scale → Direction of the scale. The vertical direction is given in brackets in each case.
In the mobile view, a visual anchorage is usually hidden, so that the space can be better used for the item texts and response options. You can change this behavior with the following PHP/CSS code on the questionnaire page.
Note: Please replace SK01 in the code with the ID of your scale question.
Note: The visual anchorage is only displayed as long as the options are shown side by side. If the display is so small that the options are shown one below the other, the (min-width: 496px) makes the visual anchorage disappear again.
pageCSS(' @media (min-width: 496px) { #SK01_head div.s2item.s2anchor div.s2input { display: block; } } ');
The response options in a scale are the same for all items, e.g., from “does not apply at all” to “fully applies”. If your items require different response options, first check whether one of the following question types is suitable:
If not, create several scale questions and display them in the questionnaire directly one below the other and without spacing: Concatenating Questions
With fully labeled scales, space may become tight. In this case, it usually makes sense to make changes to the content of the question or to use a different question type (e.g., a selection sequence). But in some individual cases, it can also make sense to align the labels of the scale points vertically.
Caution: Without further adjustments, the following solution does not work correctly on the small screens of mobile devices.
To align text rotated by 90°, first add the following CSS code in the questionnaire layout in the HTML template within the <style> section.
div.vert { height: 100px; width: 20px; overflow: hidden; position: relative; } div.vert > span { display: block; position: absolute; bottom: 0; width: 100px; height: 20px; text-align: left; transform: rotate(270deg) translate(-20px, 5px); transform-origin: 0 0; }
Please note that the exact dimensions – in particular the 100px and generally width and height – have to be adjusted to the respective scale. As an alternative to the layout, you can also include the CSS code on a single page of the questionnaire only, by means of the PHP command pageCSS(). In this case, however, you will only see the change in the questionnaire and not in the preview of the question.
Furthermore, reduce the Width of labelled values/columns in the scale question to about 40 pixels.
Finally, place the labels of the options in a <div> and a <span> tag, as in the following example:
<div class="vert"><span>Does not apply at all</span></div>
Sometimes, individual options shall not be displayed for individual items in an item battery. In the following example, the “don't know” option shall be removed for the second item.
This is achieved by using CSS to prevent the browser from displaying the option. The CSS code is included on the page with the question by means of PHP code and the command pageCSS().
If the scale has the ID “SK01” (and the item, accordingly, the ID “SK01_02”), you can hide the option with the following PHP code.
pageCSS(' #SK01_02DK, label[for="SK01_02DK"] { display: none !important; } ');
If a regular option shall be hidden – for example, the middle option (no. 3) in item 2 – only the ID changes.
pageCSS(' #SK01_023, label[for="SK01_023"] { display: none !important; } ');
Note: In the case of display errors, if the questionnaire is filled out by a bot, or if the responses are deliberately manipulated, it is possible that the answer code for the hidden option is transmitted to the server. In these cases, the code of the hidden option may appear in the dataset.