The term missing values refers to data in numeric fields that is either non-numeric or totally blank.
You may find them in data gathered from questions of the type shown below:
1. Have you ever rented a video?
Yes, have rented a video ... 1 (8)
No, have not rented a video ... 2 (GOTO Q.3) Not answered ... & (GOTO Q.3) 2. How many videos have you rented in the last month?
____________________ (9 - 10)
3. ... continue with questionnaire
If the respondent replies ‘no’ to question 1 or does not answer it at all, question 2 is not asked and columns 9 and 10 are left blank. If the respondent replies ‘yes’ to question 1 then question 2 should be coded either with a numeric value or, perhaps, with && for a don’t know answer. The blank data and && are missing values.
You may also find missing values when a numeric field is incorrectly coded with a combination of numbers and letters. This is usually the result of mistyping when the data is entered and can often be corrected by looking at the questionnaire itself and then cleaning the data within the edit section of the run.
Facilities provided by missing values processing
Missing values processing is an optional feature. If you use it, Quantum automatically detects missing values and provides a variety of facilities for dealing with them in both the edit and tabulation sections of your run. In the edit section you have:
• Automatic replacement of missing values with the special value missing_.
• An ismissing function to check whether a variable has the special value.
• Manual assignment of the special value missing_ to variables of your choice within the edit.
Switching missing values processing on and off
You can use missing values processing in the edit section, in the tabulation section, or both. To switch it on in the edit section, type:
missingincs 1 and to switch it off, type:
missingincs 0
You may use these statements any number of times in the edit to toggle between using and not using the missing values features.
✎
The missingincs statement is always executed wherever it appears in the edit. This means that although the compiler will accept statements of the form:if (....) missingincs 1
Quantum will, in fact, switch on missingincs for the rest of the edit or until a missingincs 0 statement is read. It does not switch on missingincs selectively for only those records that satisfy the expression defined by the if clause.
If a job contains an edit and a tab section and missing values processing is used in the edit, the setting of missingincs carries forward from the edit to the tab section. If the edit uses missing values processing but the tab section does not require it, remember to end the edit with a missingincs 0 statement.
Missing values in arithmetic expressions and assignments
The general rules for non-numeric data variables in arithmetic assignments are as follows:
• Blanks in an otherwise numeric field are ignored, but totally blank fields are read as zero.
• &’s in an otherwise numeric field are ignored, but fields full of &’s are read as zero.
• A – in an otherwise numeric field makes the number negative.
• Multicodes in an otherwise numeric field are ignored, but a field in which all columns are multicoded is read as zero.
If you switch on missing values processing these rules are modified so that any field that is not totally numeric or a combination of numbers and blanks is counted as missing.
Missing values are represented by the special value missing_.
Here is a table showing samples of data in a numeric field and the difference missing values processing makes to the way that data is interpreted:
If you print variables whose values are missing_ in a report file or write them out to a data file, Quantum will show their values as −1,048,576 rather than as the word missing_.
If an arithmetic expression uses a variable whose value is missing, the value of the expression differs depending on whether or not missing values processing is switched on. If missing values processing is switched on the value of the expression is always missing_. If it is switched off, the value of the expression is always zero. For example, if c(1,3) contains the string ABC:
missingincs 1 t1 = c(1,3) * 100 sets t1 to missing_, but:
missingincs 0 t1 = c(1,3) * 100 sets t1 to zero.
Manual assignment of the missing value to a variable
If you have other values that you want to replace with the missing value in the edit, you may do so by typing a standard assignment of the form:
variable_name = missing_
The variable may be an integer, real or data variable.
Data in numeric field missingincs 0 missingincs 1
123 123 123
1 3 13 13
–10 –10 –10
ABC zero missing_
1AB 1 missing_
000 zero zero
&&& zero missing_
1&1 11 missing_
three blanks zero missing_
Testing whether a variable has the value missing_
Since missing_ is a special value you cannot use statements of the form:
if (t4 .eq. missing_) ...
to test whether a variable has the special missing value. Instead, use the function:
ismissing(variable_name) For example:
if (ismissing(t4)) ....
A subroutine is a collection of statements which perform a specific task. Subroutines may be written in the C programming language or in the Quantum language. Each subroutine must have a unique name by which it can be called up when required.
Subroutines can be used to make your program more readable by eliminating the need to use go tos in certain circumstances. If you use a subroutine with a name describing its purpose it will be immediately apparent what is to be done, and it will mean you don’t have to go skipping backwards and forwards in the program in order to understand what it is doing.