QPL Reference Manual

QPL programs are written as a series of questions. Each question is equivalent to a single variable or a field in a data record. The language provides a variety of fundamental types of questions, such as multiple choice or short answer questions, which you can link together in complex arrangements through the use of skip instructions. The input methods used in the HTML form will alter the data-entry method on the computer screen according to the type of question you specify.

For each question, you must define

The sample programming code below demonstrates how to program one multiple choice question that asks the respondent to select their favoriite color.

What is your favorite color?
Don't know

After using the QPL software to build this project, this question will appear in a respondent's browser as shown below.

1.  What is your favorite color?

This question was displayed using the normal, or vertical layout. You may also use a matrix or columns layout to display questions. In a matrix layout, the question text is listed on the left and the response labels are listed as column headings to the right of the question text. In a columns layout, the questions are put in a normal layout within two or more columns across the page.

Types of Questions

Eleven types of questions are displayed to the interviewer:

You may also hide questions in your questionnaire. This is done to hold preloaded information about a respondent that is displayed in the text of other questions or used when the results are exported for analysis. Any of the above question types may be hidden except questionnaire and file upload questions.

All types of questions are programmed using the same basic syntax. The following example outlines the minimum information needed to program a single question.

QUESTION Syntax (minimal)

.QUESTION [= name], TYPE = question type
.ANSWER [= field size or name of question to copy settings]
.NEXT [= name of question to link to]

Note: Periods must be used to start command lines. The uppercase words are QPL command words, lowercase words specify the type of argument required, square brackets ([]) indicate optional settings, and the ellipses (...) indicate where the text of the question and answer are typed.

If you are using the HomeSite HTML editor, you may use the QPL tool bar question buttons to automate some of this programming. Click on one of the question-type buttons, then fill in the blanks on the dialog box that is displayed. When you click on the OK button, the QPL syntax will be inserted into your program at the current cursor position where you may further edit the question.

HomeSite QPL Toolbar

HomeSite QPL Toolbar

QUESTION and TYPE Commands

The QUESTION command defines the name of a question and where the text of a question begins. The TYPE command defines which type of question it is. These two commands must always be used at the beginning of each question.

Question Names

Each question must have a name. These names are used within the QPL project web site to specify skips to other questions and to name the data you collect in the data base. These names are also used when you build a SAS or SPSS program to analyze the data you collected on the web site.

Question names may have from one to 16 characters, but must begin with a letter (i.e., A-Z). Numbers and some punctuation characters also may be used. No blank spaces, square brackets (i.e., "[" or "]"), double quotes, commas, asterisks, or equal signs may be used in a variable name. Case is not significant. For example, the variable names "Q12" and "q12" are equivalent. Check the documentation of the analysis software you plan to use, such as SPSS or SAS, for any other limitations on naming variables.

You may explicitly name your question when write your program, or you may let the QPL compiler automatically create a name based on how the question will be automatically numbered in your questionnaire.


Here, this question has been named: "YOURNAME." This is the name you would use when analyzing the results of your survey for this question.

Alternatively, you could let the QPL compiler create a name by not setting any name in your program.


In this case, if this happened to be the first question in your questionnaire, it would be named "Q1."

Generally, you should let the QPL compiler create the names for you since this makes it easier to match the question numbers you see on the form with the question names you will use when analyzing the results. As you insert and move questions, the names will be re-generated to match the question numbers when you re-compile your program.

The prefix letter used to create a name will change based on how a question is used in your program. The table below summarizes the auto-naming rules.

Auto-Naming Rules

If the question is... Then name the question with...
Visible and numbered Q + the question number
Visible and not numbered U + the un-numbered question sequence number
Hidden H + the hidden question sequence number

Question and Answer Text Lines

Text lines contain the actual text of a question or answer. They can begin with any character, except an asterisk, a carriage return, or a period. See Text Format Options for information on how to apply special effects on your text like bolding.

Text lines must be less than 500 characters long. You can have any number of text lines for your question or answer list. Where you break the lines when writing your program is not important. The lines will be re-wrapped when they are displayed in the respondent's browser.

Each answer label in a multiple choice, check-all-that-apply, or drop-down list question, however, must be written on one line.

The question text lines also will be used as variable labels when you convert your program to SPSS or SAS statistical analysis programs. In this case, the question text lines will be merged together until the character label limitation for SAS or SPSS is reached.

LABEL Command

You may set an alternative label for a question in your statistical program by using the LABEL command inside the question.

.LABEL = "Respondent Name"
What is your name?
.ANSWER = 10

In this example, the respondent will see the question, "What is your name?," but when you build your SAS or SPSS program, this question will be labeled as "Respondent Name."

ANSWER Command

The ANSWER command defines the end of the question text and the beginning of the answer text. It also can use a option that lets you set the default answer, field size, or copy these settings from another question. Only multiple choice, check-all-that-apply, and drop-down list questions may have more than one answer text line. The other types of questions may use the number of characters in the answer text line to define the width of the variable field in the data file.

NEXT Command

The NEXT command defines the end of the list of answers and the end of the question. It can also be used to specify which question to skip to if you do not want to go to the next question in the list.