Creation of dummy variables and summary table for multiple response data
mrdum varlist [if exp] [in range], stub(string) [responses(numlist) labels[(valuelabelname)]]
Description
For general use, mrdum searches across varlist for integer codes and creates corresponding binary dummy variables. Each dummy is equal to 1 if the integer code was found anywhere in varlist, 0 if not, and missing if all of varlist is missing. It also displays a table summarizing the results.
This program was created specifically to deal with survey questions wherein the respondent can give multiple responses to a single question (e.g. "Check all that apply"). Sometimes these data are coded as a series of variables with the responses entered in the order that the respondent indicated them. Often, however, it is useful to have instead a set of binary dummy variables that indicate whether the respondent indicated a particular response regardless of the order in which it was indicated.
If you are interested in the order that responses were indicated, see Eric Zbinden's zb_qrm.
Options
stub(string) specifies a stub for the resulting dummy variables. The stub should be short enough for all the complete names to be legal. This is a required option. responses(numlist) allows the user to specify exactly which responses (integer codes) are of interest. If this option is not specified, the command will assume that the responses are coded from 1 to n, where n is the number of variables in varlist.
labels has two possible syntaxes. With no argument, this option displays any value labels attached rather than the numeric codes. Any or all of varlist can be labelled. This option can also take a previously defined value label name as an argument.
Examples
. mrdum f4m1-f4m7, stub(q4) lab This produces seven dummy variables for responses coded 1-7 plus a dummy to indicate which cases are completely missing (if there are any that are completely missing). The table produced will show value labels rather than numeric codes.
. mrdum f4m1-f4m7, stub(q4) res(1/4,7) This produces four dummy variables for responses coded 1-4, one dummy for responses coded 7, and one to indicate which cases are completely missing.
. lab define colour 1 "red" 2 "blue" 3 "green" . mrdum f4m1-f4m3, stub(q4) labels(colour)
Author
Lee E. Sieswerda Thunder Bay District Health Unit Lee.Sieswerda@tbdhu.com
Acknowledgements
Nicholas J. Cox made significant improvements to the code.
Manual: [R] numlist, [U] 14.1.8 numlist, [R] egen, eqany On-line: help for numlist; egen See Also: help for zb_qrm if installed