ccmatch is used to randomly match cases and controls based on specified criteria. For instance, if you wanted to randomly match cases and controls based on age, you can use ccmatch to pair up people with the same age. You can use multiple variables to match cases and controls.


ssc install ccmatch


ccmatch variable_list, cc( ) [id( )]

specifying an id is optional

ccmatch creates one to two variables:


match_id match name case_control age
a6 1 a2 0 15
a2 1 a6 1 15
a7 2 a4 0 16
a4 2 a7 1 16
a8 3 a5 0 17
a5 3 a8 1 17
a10 4 a1 0 19
a1 4 a10 1 19
. a3 0 15
. a9 1 18

The table above shows example ccmatch output. The highlighted variables were created by ccmatch. The original data (name, case_control, age) is unchanged, except that it has been reordered. The command used was:

ccmatch age, id(name) cc(case_control)

Age was specified following ccmatch to indicate that we wanted to match case/controls who are the same age.

The case/control variable is specified as an option using cc( ), and the id of each individual is specified using id( ).