Data editing > Data validation
 
Data validation
You can examine the data for a set of records (with count) or for an individual record (with write). However, usually, you want to check the validity of the data for individual records by putting in the edit a set of testing sentences which will tell you not only whether a record contains an error but also what that error is.
There are two types of checking sentence:
1 Check whether a column contains the correct type of coding (single-coding/ multicoding) and whether the codes in that column are valid. Take the question on a respondent’s sex which might be Male, coded c106’1’, or Female, coded c106’2’. c106 must be single-coded because a person cannot have two sexes, and the only codes which may appear in that column are 1 and 2. Any record in which c106 is not single-coded with a 1 or a 2 will be flagged as incorrect.
2 Make sure that columns whose contents depend on the contents of other columns contain the correct codes. For example, suppose the questionnaire asks whether the respondent has ever used a particular brand of washing up liquid. The answer is coded into c125 as ‘1’ for Yes and a ‘2’ for No. If the answer is Yes, the next questions concerning price and quality are asked. If c125’2’ indicating that the respondent has not used that brand of washing up liquid, the following columns must be blank. Conversely, if c125’1’, the following columns must be coded according to the codes on the questionnaire.
See
require
Column and code validation
Validating logical expressions
Testing the equivalence of logical expressions
Actions when a require statement fails
Combining testing sentences