Check SPSS Export Quality

Description

Reads an exported .sav file and audits its structure to confirm that variable labels, value labels, and missing value codes are correctly applied. Prints a formatted summary report and invisibly returns a list of audit results.

Usage

check_sav_export(file_path, sentinel = -99, show_all = FALSE)

Arguments

file_path Character string. Path to the .sav file to check.
sentinel Numeric. The missing value sentinel to look for. Default -99.
show_all Logical. If TRUE, prints details for every variable including those that pass all checks. If FALSE (default), only prints variables with issues.

Value

Invisibly returns a list with components:

variables
Data frame with one row per variable and audit columns.
n_vars
Total number of variables.
missing_var_labels
Variables with no variable label.
missing_val_labels
Numeric variables with no value labels (informational only – not all numeric vars need them).
missing_na_values
Numeric variables where sentinel appears in data but is not declared as SPSS missing.
sentinel_not_found
Numeric variables with NAs in raw data but no sentinel value found in export.