*! version 1.1.1 15dec2022

Title

dc -- Data Check

Syntax

dc varlist [, options]

Identifier
isid checks whether the specified variables uniquely identify the observations (there are no missing or duplicates values)

Range
vl(valid_list) list of valid values; examples: 150/200, 0/80 99, 1 2 3, F M

Dictionary File
table(filename) use a dictionary to check the values of the specified variables

vk(varname) variable name with the valid values on the dictionary file

Date Range
di(date) Initial Date, DMY format; examples: 01/04/2006, 01jan2012, 15-6-1997

df(date) Final Date, DMY format; examples: 01/04/2006, 01jan2012, 15-6-1997

Date Difference
dd(date_diff) Date difference expression, as a substraction

ddl(min_val) Minimum value of the date difference

ddl(max_val) Maximum value of the date difference

ddunit(units) Date difference units; valid values are days (default) or years

General
id(varlist) Identifier variables

nd(num_dec) Number of allowed decimals; by default nd(0)

varl(varlist) List of additional variables to list

nomissing Treat missing values as errors; by default missing values are allowed

nodups Treat duplicate values as errors; by default duplicate values are allowed

Logical Check
code1(#) Error code for logical check 1

expr1(expr) Logical expression that identifies the logical check 1

code2(#) Error code for logical check 2

expr2(expr) Logical expression that identifies the logical check 2

code3(#) Error code for logical check 3

expr3(expr) Logical expression that identifies the logical check 3

code4(#) Error code for logical check 4

expr4(expr) Logical expression that identifies the logical check 4

code5(#) Error code for logical check 5

expr5(expr) Logical expression that identifies the logical check 5

Description

Data Check.

An observation number variable called _ObsNum must exist in the dataset before any dc call.
To create this variable, execute:

. generate _ObsNum = _n

Auxiliary variables named _Er_varname are added to the dataset for each checked variable (any existing variable
with the same name will be replaced). These auxiliary variables
are used to store error codes, and allow the dcreport command to create an Incidence Report, see dcreport.

Up to 5 optional logical checks are available. To define a logical ckeck, assign an error code greater than or equal to 10
and write the logical expression that identifies the error; the expression must be true when there's an error.

You can click here to pop up a dialog or type db dc.

Execute net from http://metodo.uab.cat/stata for install.

It is important to keep the commands updated. Execute adoupdate dc, update to update the dc command.

Execute adoupdate, update to update all the user-written commands.

If you find any bugs or want to suggest any improvements, please send an e-mail to: leam@uab.cat.

Examples

. dc Id, isid

. dc Peso, vl(45/120) nd(1) id(Id)

. dc H1 H2 H3, vl(0 1 2) id(Id)

. dc Sex, vl(F M) id(Id)

. dc CIE, table(C:\...\CIE9.dta) vk(cie9) id(Id)

. dc FR, di(01/04/2006) df(15/04/2006) nomissing id(Id)

. dc FN, dd(FR-FN) ddl(18) ddu(90) ddunit(years) id(Id)

. dc PAS, vl(100/200) id(Id) code1(10) expr1(PAD>=PAS & PAD<.)

Version

Version 1.1.1 -- 15 December 2022

Authors

JM.Doménech

Programmer: R.Sesma

Laboratori d'Estadística Aplicada

Universitat Autònoma de Barcelona

leam@uab.cat

Vancouver reference

Doménech JM. Data Check: User-written command dc for Stata [computer program].

V1.1.1. Bellaterra: Universitat Autònoma de Barcelona; 2022.

Available executing from Stata: net from http://metodo.uab.cat/stata

References

Bonillo-Martín A. Sistematización del proceso de depuración de los datos en estudios con
seguimientos [Tesis doctoral]. Barcelona: Universitat Autònoma de Barcelona; 2003.