How to Code Comma-Delimited Spontaneous Awareness Data

From Q
Jump to navigation Jump to search

Sometimes spontaneous awareness data is captured in a single text box with commas delimiting separate responses. Prior to using Q's coding variables it is necessary to split such data up into multiple variables. This is done as follows:

  • In the Variables and Questions tab right-click on the variable that contains the text and select Insert Variable(s) > JavaScript Formula > Text.
  • In the Expression field, type (myVar).split(',')[0], replacing myVar with the name of your variable. This will create a variable containing the first item (i.e., the text preceding the first comma).
  • Fill in the Name and Field question as appropriate.
  • Press OK.
  • Right-click on the newly-created variable and select Copy and Paste Variable(s) > Exact Copy.
  • Right-click on the copy and select Edit Variable.
  • Replace [0] with [1].
  • Keep repeating the above three steps, increasing the number in the square brackets each time, until you have as many variables as are required.
  • Select all the newly created variables, right-click and select Set Question and set them as a Text - Multi.

You can then use the steps described in Help > Online Training > Manipulating Data > Coding Text Data > Coding Spontaneous Awareness to do the coding.

In situations where the data is not so neat (e.g., people have used spaces to delimit, or have used 'and') it is still possible to split the variables up but the required JavaScript is more complicated and there is no one-size-fits-all solution.

See also