hilo

How to clean a survey dataset before analyzing it, in 5 steps

The check runs in your own browser and the file never leaves your computer.

Step 1

Check that the file reads correctly

Before going into the data, a quick check of its structure: how many rows and columns it has, whether every row has the same columns, and whether the first row holds the variable names. A separator or a quote mark typed inside an answer, or the single quotes of an SPSS export, split a row and shift the rest of the values without anyone noticing.

Step 2

Look for repeated cases

A case loaded twice counts double in every percentage. Look for identical rows and, separately, for identifiers that repeat: if two different rows have the same ID, one was loaded wrongly or two people share a number. Delete the copies, but don’t pick blindly which of two rows with the same ID is the right one: check the source.

Step 3

Review empty, nearly empty and single-value columns

A column without a single answer is usually a question nobody saw because of a form filter. In one that more than half left blank, any average is calculated over very few cases. And one with the same value in every case, like the survey year, adds nothing. Decide what to do with each one.

Step 4

Spot non-response codes and values that don’t belong

A 99 or a −1 that means “no answer” and gets into the average as if it were a response ruins it without warning. The same happens with a numeric column where someone typed “don’t know” (one is enough for the program to read the column as text) and with decimals written with a comma and with a period, 3,5 and 3.5, which depending on the program’s language are read some as numbers and some as text. Leave blank what wasn’t answered, move the answers written in words to another column and use a single decimal separator.

Step 5

Fix at the source, check again and document

Fix a copy of the source file, never the original: delete the copies, resolve the IDs, leave blank what wasn’t answered, unify the decimal and remove the columns you don’t need. Keep one row per case and one column per variable. Save the corrected version under another name and note what you changed (which rows you deleted and why, which codes you turned into blanks), so you can explain and repeat it.

Other ways to do it

You can do it by hand in a spreadsheet (filters, sorting and pivot tables to count odd values), with OpenRefine to clean and transform, or with a script in R or Python.

HILO is the better fit for a quick first check: it runs in the browser, there’s nothing to install, it’s free, it needs no sign-up and the file never leaves your computer. Another tool is the better fit if you need to fix the data inside the program, keep the cleaning in a repeatable script or work with very large files.

Check your own dataset

Load an Excel or CSV file and see, in seconds, the list of what HILO found.

Updated