Using Special Codes and Missing Values in QDS Expressions

QDS does not treat special code values as numeric in expressions even though they appear as numeric on the Response Set tab.

When you need to refer to a special code or missing value in a QDS expression, such as in a Skip Element, Edit Element, or Automatic Variable calculation, you need to refer to them as follows:

Special Codes

  • Don’t Know = .DK
  • Refused to Answer = .REF
  • Not Applicable = .NA
  • Skipped = .SK (Standard or Alternate Code)
  • Standard Skipped Only = .SK1
  • Alternate Skipped Only = .SK2

See Special Code Values.

Missing Values

  • Missing = .MSG (Automatic Variables)
  • Missing = . (Data Entry)

See Missing Values.

Special Codes and Missing Values in Equality Expressions

For example, if you wanted to skip over some items in your survey if the response to VAR1 was equal to “Don’t Know” or “Refused to Answer” or an Automatic Variable was assigned a missing value, you would enter the instructions as:

  • VAR1 = .DK or VAR1 = .REF (where VAR1 is a previously created Data Element)
  • AV1 = .MSG (where AV1 is a previously created Automatic Variable)

Special Codes in Other Expressions

Similarly, you might have a question, "How many days did you smoke a cigarette in the past week?" where the valid range of responses is 0 to 7 days (Variable Name = CIG_DAY). You also have allowed options of .DK, .REF, and .NA.

Special Codes options on Response Set tab

Then you need to skip the question:

"How long have you been smoking three or more days a week?"

... if the response to CIG_DAY was less than three.

If you enter the following expression in your Skip Element

If: CIG_DAY < 3

QDS will skip under the following conditions, assuming all skip and calculations options are left at default settings:

  • CIG_DAY is less than 3
  • CIG_DAY is Skipped
  • CIG_DAY is Not Applicable

QDS will not skip:

  • CIG_DAY is greater than or equal to 3
  • CIG_DAY is Don't Know
  • CIG_DAY is Refused

QDS does not treat special code responses as numbers. Under default settings on the Calculations tab, Don't Know and Refused are evaluated as if the Data Element had an unknown value somewhere within the allowable range. So, in this example, Don't Know and Refused are treated as a range of numbers [0-7] since this was set as the maximum and minimum allowable values on the Response Set tab. Since the evaluation of [0 - 7] < [3 - 3] is "maybe", QDS does not skip when the "Branch if condition evaluates to MAYBE" option on the Skip or Edit Element tab is unchecked (default setting).

By contrast, special code responses of Not Applicable and Skipped are treated as '0' by default on the Calculations tab; since 0< 3, QDS would skip for these special code responses.

If you preferred to also skip for Don't Know and Refused responses, you can change your skip expression to:

If: (CIG_DAY < 3) OR CIG_DAY = .DK OR CIG_DAY = .REF

These defaults can be changed on the Calculation tab for each Data Element or under Data Defaults on the Calculations tab.

See About Skips, Edits, and Markers for more information on branching.