Topics Map > User Guides
Topics Map > REDCap
REDCap: Missing Data Codes
Use custom 'Missing Data Codes' to note why a field's value is blank. Missing codes can aid in data analysis by giving the reason why a field lacks a value.
How to Enable Missing Data Codes:
To use the Missing Data Code feature, enable it in Project Setup from the "Additional Customizations" menu:
The missing codes are coded just like the choices of a multiple choice field. Enter the code, followed by a comma and the label. The codes can only have letters, numbers, dots, dashes, and underscores (e.g., '-999, Not asked' or 'UNK, Unknown').
If you do not enter any missing codes, the feature will remain disabled.
Tip: When setting your missing data codes, make sure that they will never clash/overlap with a potential real value. (For example, if you have an integer field where '-999' is a possible value, then you should not use -999 as a missing data code.) If the missing code were entered as an actual value, REDCap would not know if the value was real data or a missing code. REDCap provides a list of suggested missing codes, but you can set custom codes if needed.
All the missing data codes you set up are displayed for reference at the top of the Codebook page.
Data entry with Missing Codes:
After you set up missing data codes, you will see an 'M' icon next to each field when entering data on a form. To use a missing data code, click the 'M' icon to open your list of missing data codes and select one. Once you select a missing data code, REDCap will save the missing code as the literal data value for the field.
For a multiple choice drop-down field, the missing codes will show up in the drop-down menu:
Note: Missing data codes will only work for data entry forms, and not surveys. Entering a missing data code must be done manually by a logged-in user in the REDCap interface.
Importing Missing Data Codes (Data Import tool or API)
Missing data codes can be entered by data import, similarly to normal data. You can import missing codes through either the Data Import Tool or API. To import missing data codes, simply import the value as the missing data code as the value in your data import file. (e.g. import value as OTH, UNK, -999, etc as shown in the image above).
Field Types:
You can use missing data codes for any field type (e.g., short text, multiple choice, date, slider, file upload fields). Because a missing data code is saved as the field value, it can then be optionally exported in a data export or viewed in a report. You can choose to include missing codes in a report or export where they will show up as if they were multiple choice options. You can also choose not to include missing codes in reports or exports.
Using Branching Logic:
If a field should be hidden by branching logic and contains a value, REDCap will typically ask if you wish to delete the value of the field being hidden. However, if the field has a missing data code saved for it, REDCap will hide the field but will not ask if you would like to remove the missing data code. This allows a field to still be “blank” and have a missing code even if it is also being hidden by branching logic.
Since missing data codes are stored as the literal field values, they may be used and referenced in logic. Missing codes can be used in logic for report filters, dashboards, data quality rules, survey queues, Automated Survey Invitations, and branching logic.
For example, you might want to display a field on a form only if the previous field is blank and is marked with the missing data code 'NASK'. You could set branching logic to: [field] = 'NASK'.
There is also a special function 'isblankormissingcode()' that can be used. This function determines if a field's value is either truly blank or if it contains a missing data code. E.g. isblankormissingcode([age]), when the age field has a missing code value of UNK, then the function will return TRUE. If the field has any non-blank/non-null value that is also not a missing data code, it will return FALSE.
@NOMISSING Action Tag:
By default, the missing data code functionality is enabled for ALL fields in the project. But missing data codes can be disabled on a field-by-field basis with the action tag @NOMISSING. This action tag will hide the 'M' icon for the field on the data entry form, which will prevent usage of the missing data codes for that specific field.
Impact on Data Exports, Reports, and Data Quality Rules
Data Exports:
If you are exporting Missing Data Codes in your data into a statistical analysis package, it is possible that the CSV data might not load correctly. For example, if you have set a field to be a date in your statistical software, then trying to import a missing code could cause an error. You may need to manually modify the syntax file before loading it into your statistics software so your Missing Data Codes will be accepted. Otherwise, you can try exporting your data without the Missing Data Codes.
Reports:
There is a new report option under the “Addition report options”: “Display any Missing Data Codes in place of blank values (where applicable)”. This allows you to choose to either show or not show the Missing Data Codes (if any have been saved) in the report or export. Note: In PDF exports of data collection instruments, any Missing Data Codes will be represented as blank values in the PDF.
Data Quality Rules:
- DQ Rule A and DQ Rule B (for finding blank values) will continue to return only truly blank values. These rules will not return fields with missing data codes saved as the value.
- DQ Rule I New rule- (Fields containing missing data codes). This rule will specifically find fields with missing data codes saved as the value.
- DQ Rule F (Hidden fields that contain values) will ignore fields that have a missing data code saved as the value. Rule F will ignore missing codes because it is allowable for these fields to be hidden by branching logic even if they have a missing code saved.
Suggested Missing Data Codes:
This is a standardized list of suggested missing codes, which will be available in the missing data code setup:
Code | Meaning / Label |
---|---|
NI | No information |
INV | Invalid |
UNK | Unknown |
NASK | Not asked |
ASKU | Asked but unknown |
NAV | Temporarily unavailable |
MSK | Masked |
NA | Not applicable |
NAVU | Not available |
NP | Not present |
QS | Sufficient quantity |
TRC | Trace |
UNC | Unencoded |
DER | Derived |
PINF | Positive infinity |
NINF | Negative infinity |
OTH | Other |