Back-Reference Displays
Displaying prior responses in the text allows you to personalize questions without expecting interviewers to remember previous responses. This is referred to as back-referencing the response to a question.
Single Responses
To back-reference a single response question, use this syntax:
\:label \:label: \:QQ# \::label (See using this option below)
Back-referencing shows the answer for the question when it was executed. If the question has not been asked, nothing will be displayed, even if there is data in the same location as the question.
If the question was asked, back-referencing the question will display its response, unless a question with ALIAS=<same label> has been asked between the original question and the question you are back-referencing, in which case its response is picked up (See QUESTION LABEL LINE).
If the question was asked and there was no alias question, the data and the back-reference will be the same for NUMERIC, EXPRESSION and VARIABLE questions. To avoid confusion, you may want to use \|qname for NUMERIC, EXPRESSION and VARIABLE questions.
If you are back-referencing a FIELD question, the first response’s text is shown (not the response code). For TEXT questions, the text of the response is shown.
NOTE: If the response list is made up of codes only and no text, then you must display the contents of the data location (\|) since the back-reference will otherwise be blank.
Here is a sample question that back-references a previous response:
EXAMPLE:
Of these \:NUMCHILD children, how many are in college?
The response from question NUMCHILD would be inserted into the text of this question.
NOTE: The label must start with a colon (:label); an ending colon after the label is optional.
The space used on the screen by the response is variable depending on the actual length of the response. You can control the amount of space used by appending a caret (^) and the number of spaces to use.
EXAMPLE:
Brand A - \:BRANDA^10 is the favorite Brand B - \:BRANDB^10 is the second favorite
In this example, the display of the text from question BRANDA and BRANDB will use 10 spaces on the screen. By specifying a width you can keep the text to the right of BRANDA and BRANDB’s response lined up properly. If the text is longer than the width specified, it will be truncated. You can use a dash (-) before the number of spaces to right-justify the text.
EXAMPLE:
Brand C - \:BRANDC^-10 is the next favorite
NOTE: Leaving spaces between the label and the caret will not affect screen presentation but will allow you to line things up as you’re writing them.
EXAMPLE:
NAME: \:NAME ^-20 ADDRESS: \:ADDRESS1 ^-20 (home address) \:ADDRESS2 ^-20 \:CITYSTAT ^-20
You can also reference a previous response by question number, using a QQ# reference (e.g., \:QQ#).
EXAMPLE:
\:QQ20
NOTE: Do not back-reference soft-coded question numbers (i.e., question numbers you have not coded yourself, but picked up from a CHK or SUM file.)
\::label Option
Using the \::label option will display the current information of a question, while using the options above will give you the information of when that question was executed. If the data has changed due to another question changing/overwriting the data or if the original question was not executed, then this option will display different information.
Multiple Responses
You can reference any or all of a multiple-response FIELD question’s responses. The response text for each response chosen is displayed on the screen, separated by commas.
The syntax for referencing a multiple-response question’s response is:
\#(label,first response,number of responses)
Only the question label is required. To see all the responses to a question in the order they were entered, use \#(label).
EXAMPLE:
The cars you own are: \#(CARS)
This would show all the responses to the question CARS. To see only specific responses, enter the first response and number of responses parameters.
EXAMPLE:
The two best cars you own are: \#CARLIKES,1,2)
This would display the first two responses to the question CARLIKES, separated by a comma.
You will not get a spec error if you incorrectly specify more responses than available.
EXAMPLE:
\#(name,4,3)
The above example will show up to three responses starting at the fourth response.
If you are using an alias question to join an “Other (specify)” response to the pre-listed responses, the “Other (specify)” response will be treated the same as the pre-listed responses. What is being displayed is coming from the answer array, not the data.
The answer array is a memory area where Survent keeps track of answers given previously so you can do back-references to them. When you compile your specs, PREPARE makes a note of the questions that are used in back-references in \:label references, SPECIAL,SAVE_TEXT_LINE_TO_DATA question types, as loop controllers, or TEXT questions that are edited so that Survent can store their answers as they are entered. For related information, see the header statement option ANSWER_LENGTH.
Normally only the first response to a question is stored. If the question is used as a loop controller or is referenced with the \#(label) syntax, then all the responses to that question are stored in the order of mention. If you are using alias names, then the last alias question will overwrite any previous answer, unless you are storing all the responses (as above), then each alias response is appended to the end of whatever responses already exist. Use (O=label) to get the other response inserted in proper order in the answer array.
Blanking out the data does not affect the answer array, nor does backing up in the questionnaire using a backward GOTO or a backward SKIPTO. A GENERATE,ERASE_ANSWER_ARRAY can erase the answer array of a particular question should you need to.
Data Locations
You can display data directly with the \| syntax. This is useful if you have a counter and you want to know the current value without putting a VARIABLE,USE_PREVIOUS_ANSWER on top of the location first, or when referencing existing data in Coding mode, or using PHONE, GET_PHONE_INFORMATION statements to get sample data.
The syntax for displaying data directly is:
\|location|
The backslash is followed by a vertical bar (|), a location specification and another vertical bar. The ending vertical bar is optional. The location specification can be an absolute location and width (i.e., \|col.wid|), or a location specified as starting column – ending column (25 – 30). Where no length is specified, it defaults to 1. Or, it can be a prior question label surrounded by colons \|:label:|.
EXAMPLE:
You said you had \|20.5| Bentleys, is that correct? You said you had \|20-24| Bentleys, is that correct?
Both of the above examples will echo what is in the data in columns 20-24.
EXAMPLE:
You said you had \|NUMCARS| Bentleys, is that correct? You said you had \|NUMCARS Bentleys, is that correct?
This will do the same thing as the prior example, if NUMCARS was in location 20.5.
You may also specify a ^# or ^-# after the location. This will control the number of spaces allotted to the answer on the screen. By specifying a width, you can keep text to the right of the answer lined up properly. If the data is longer than the width specified, it will be truncated. Using -# will right justify the answer within that field width.
EXAMPLE:
You have \|10.5|^7 cars, is that correct?
NOTE: Leaving spaces between the ending vertical bar and the caret will not affect screen presentation but will allow you to line things up as you’re writing them.
Phone File Information
Using the \[<label or location>] option allows you to display any label or position in the phone file.
EXAMPLE:
\[1.10] would display the phone number, as would \[phone_number]
You may have as many of these references in the question text as you would like.
Interviewer Summary Log File Information
Using the \|%<location| option allows you to display data from the interviewer summary log file (intvr_log).
EXAMPLE:
\|%121.5| would display the contents of 121.5 in the interviewer summary log file (number of seconds currently connected for).
You can use this syntax in conjunction with the !SPECIAL,SAVE_TEXT_LINE_TO_DATA to store it in the data. You may have as many of these references in the question text as you would like.
Environment Variables
You can read environment variables into your questionnaire by using \!. You make environment variables by saying (at the operating system prompt):
setenv name value (UNIX)
SET name=value (DOS)
By specifying \!variable name, the current setting of the variable will display on the screen or be put into the data if using an SPECIAL,SAVE_TEXT_LINE_TO_DATA.