Numeric Question Type
Numeric questions are used to collect data such as price, miles driven, or number of people in a household. Numeric questions have several options to let you specify various parameters for acceptable responses.
The syntax for a Numeric question type is:
!NUMERIC,subtype,<NUMBER_OF_DECIMALS=>#,range,other number,exception codes
Specifying a subtype or any of the other items is optional. The data location width default is set to the maximum length needed for the allowable range, and can be up to 16 columns (a 10 digit number, preceeded by a + or -, a decimal point, and four decimal places). Unless a range is specified, the default width is 9 columns. Using the NUMERIC_WIDTH_REQUIRED header option requires that you specify either a range, or a width on the question label line.
NOTE: What is put into the data for a NUMERIC question is the numeric value of the response, which is not necessarily the same as the number entered by the interviewer. If the interviewer enters 25 for example, you can see various values depending on the subtypes used. You can see 25 if no subtype is used, 0025 if the ZERO_FILL subtype is used, 25.00 if the NUMBER_OF_DECMALS=2 subtype is used, or +25.00 if the LEFT_MOST_SIGN_FOR_ODBC subtype is used.
Valid Subtypes
- Any_Decimal_Entry
- Blank_Ok
- Blank=
- Left_Most_Sign_For_ODBC
- Number_Of_Decimals
- Range
- Use_Same_Rules_As_Label
- Zero_Fill
ANY_DECIMAL_ENTRY
Shortform: NUM,ANYDEC
Allows varying numbers of decimal significance, up to a maximum of the NUMBER_OF_DECIMALS value.
EXAMPLE:
{ QANYDECIMALENTRY: Enter a number !NUMERIC,ANY_DECIMAL_ENTRY,NUMBER_OF_DECIMALS=2,1-10.50 }
This allows a numeric response from 1 to 10.50. The interviewer does not need to enter any decimal value at all, or can enter up to two decimal values.
BLANK_OK
Shortform: NUM,BLANK
Allows the question to be unanswered (and thus blank in the data). Use this with caution as it is difficult to track the interviewers’ movements if some questions are blank.
BLANK=”string”
This keyword puts data into a question that is left unanswered if presented. The question subtype must be BLANK_OK (see above) or the question must be inside of a !GRID,BLANK_OK statement (allow blank in grid of questions). The “string” must fit into the width of the question. The “string” must also exactly match one of the alphanumeric exception codes allowed on the question.
EXAMPLE:
{ QNUMERIC: .10 Enter a Value: !NUMERIC,BLANK_OK,,1-99,,DK="DON'T KNOW",NOANSWER="NO ANSWER",blank="NOANSWER" }
This will save the string NOANSWER into the data and answer array.
LEFT_MOST_SIGN_FOR_ODBC
Shortform: NUM,LSIGN
Saves enough room for the response to include a plus or minus sign along with the number. This is necessary if converting the data to a SQL database later on.
NUMBER_OF_DECIMALS
Shortform: NUM,NUMDECS
The NUMBER_OF_DECIMALS option tells the program how many decimal places of significance the interviewer must enter. If specified, the interviewer will have to enter a decimal point and the required number of digits (unless subtype ANY_DECIMAL_ENTRY is used). The decimal point will use a column in the data. The default is no decimal places allowed (not even a decimal point). NUMBER_OF_DECIMALS lets you specify up to a 4-digit decimal value.
EXAMPLE:
{ QNUMBEROFDECIMALS: Enter a number !NUMERIC,,NUMBER_OF_DECIMALS=2,1-10.50 }
This allows a numeric response from 1 to 10.50. The interviewer needs to enter two decimal points.
RANGE
Shortform: NUM,RANGE
The Range keyword was created so that you no longer need to make sure that the options are positional on the NUMERIC keyword line and so that you can easily extract what the range is from other numbers that might be on the line.
You cannot use a subtype abbreviation when you use RANGE, you must use the long keyword. You can also use exception codes after the RANGE statement using commas as placeholders if necessary.
EXAMPLE:
{ QRANGE1: Enter a value !NUMERIC,ZERO_FILL,RANGE=1-99 } { QRANGE2: Enter a value !NUMERIC,RANGE=1-999,,DK }
USE_SAME_RULES_AS_LABEL
Shortform: NUM,SAMEAS
This is used when you want to use the same range for more than one question. Use the USE_SAME_RULES_AS_LABEL in place of the range and the program will use all of the parameters from the specified question. This USE_SAME_RULES_AS_LABEL option can only be used if the question exists prior to the current question and the two questions are both NUMERIC type questions. The USE_SAME_RULES_AS_LABEL will cause all of the previously specified parameters to be used, including: subtype, NUMBER_OF_DECIMALS=, range, other number, and exception codes.
EXAMPLE:
{ QSAMEAS1: How much would you pay for product 1 given a price range of $1.99-$3.99? !NUMERIC,,NUMBER_OF_DECIMALS=2,1.99-3.99,,DK,RF } { QSAMEAS2: How much would you pay for product 2? !NUMERIC,USE_SAME_RULES_AS_LABEL QSAMEAS1 }
ZERO_FILL
Shortform: NUM,ZEROFILL
Zero-fills the data field. The default is to right-justify the number, and precede it with blanks.
EXAMPLE:
{ QZEROFILL: What is the value of your assets? !NUMERIC,ZERO_FILL,,0-9999999 }
This allows a numeric response from 0 to 9,999,999. The interviewer never has to enter leading zeros since the ZERO_FILL subtype will right-justify the number entered and fill any blanks with zeros.
Other Numbers and Exception Codes
If you specify a range, you may also want to allow some other number outside the range. The other number gets specified after the range and will be right-justified in the data field. The other number is affected by the ZERO_FILL subtype. The other number must be a single number, not a range of numbers, or it can be a label of another NUMERIC question.
EXAMPLE:
{ QOTHERNUMBER: How many are used at home? !NUMERIC,,,1-50,99 }
This would allow a response from 1-50 or 99 as the other number allowed outside of the range.
Up to three other exception codes may be specified. They may be any alphanumeric characters, other characters (except ~, {, }, !, [, ] and comma), and must be one to ten characters long,. Upper and lowercase are treated the same; the answer goes into the data as uppercase. Exception codes are stored left-justified in the data rather than right-justified, even if they are numeric. Exception codes will not be affected by the ZERO_FILL subtype. Some standard exception codes are DK (Don’t Know), NA (No Answer) and RF (Refused).
EXAMPLE:
{ QEXCEPTIONCODE1: How many children do you have? !NUMERIC,,,0-20,,DK,NA,REFUSED }
No question subtype or number of decimals is specified. The range is 0 – 20. There is no other number specified and there are three alpha exception codes: DK, NA and REFUSED.
You can assign text to an exception code. This text would appear in the stubs of tables you define in Mentor or on the screen instead of the exception code abbreviation when using online surveys.
EXAMPLE:
{ QEXCEPTIONCODETEXT: How many children do you have? !NUMERIC,,,0-20,,DK:"Don't Know",NA:"No Answer",RF:”Refused” }
No question subtype or number of decimals is specified. The range is 0 – 20. There is no other number specified and there are three alpha exception codes: DK, NA and RF. The stubs of tables and on screen will display the text associated with the 3 exception codes.
By default, exception codes are not included in statistics and numeric counts in Mentor. You can assign a numeric value to an exception code by saying ”=#” after the exception.
EXAMPLE:
{ QEXCEPTIONCODEVALUE: How many children do you have? !NUMERIC,,,0-20,,DK=10,NA,REFUSED }
This says if someone enters “DK”, Mentor will use the value “10” for any sums or statistics, but NA and REFUSED are not included in those categories.
NOTE: It is not possible to combine these two types of exception code options (DK=10 and DK:“Don’t Know”).
Other Types of Examples
You may make either end of the allowable range relative to another question. In place of a number, you could enter a question label. The allowable minimum or maximum would be the previous question’s response. This example allows a response from 1 to the response in the question TOTMONEY.
EXAMPLE:
{ QNUMERICPREVLABEL: How much of this money is used for household expenses? !NUMERIC,,,1-TOTMONEY }
The numeric range can also have data location references. Use brackets ([ ]) around the location(s). This example sets the minimum as the number in column 10 for a length of 5 ([10.5]), and the maximum as the number in column 20 for a length of 5 ([20.5]). Make sure you have valid numbers in the locations if you use this type of reference.
NOTE: This example shows using a comma instead of a dash in the range.
EXAMPLE:
{ QNUMERICDATALOCS: Enter the amount of your salary you used for vacations !NUMERIC,,,[10.5],[20.5] }
NUMERIC questions can also use ?# or >=# as the range. This example allows responses less than or equal to the response to TOTCHILD. The less than and greater than characters (< and >) will be interpreted as ? and >=.
EXAMPLE:
{ QNUMERIC: How many of the children are less than 10 years old? !NUMERIC,,,<=TOTCHILD }