------------------------------------------------------------------------------- help for labelmiss Stas Kolenikov, skolenik@unc.edu -------------------------------------------------------------------------------

Label the missing data

labelmiss [varlist] mval "text" [ mval "text" ...] , modify

labelmiss changes the labels of the missing data for selected variables. mval is one of the missing values, either the system missing value . or the extended missing values .a, .b, etc.

Options

modify allows Stata to overwrite the existing label, thus indicating your understanding that the labels are going to be modified. It is not optional. If you want to be able to recover your original labels, or you would want to define differential labels for different variables, see label, and label save, in particular.

Example

Suppose we have the data in the following form:

. li id obsw cluster x1-x3 in 1/12

+----------------------------------------------------------------+ | id obsw cluster x1 x2 x3 | |----------------------------------------------------------------| 1. | 1001 13.823839 1 Yes N/A Refused | 2. | 1002 12.876063 1 Yes Yes Yes | 3. | 1003 16.9282 1 Yes Yes Don't know | 4. | 1004 16.752894 1 Yes Yes Refused | 5. | 1005 13.399568 1 No Don't know No | |----------------------------------------------------------------| 6. | 1006 14.806043 1 Refused Yes No | 7. | 1007 13.447599 1 Yes Yes No | 8. | 1008 18.986893 1 No Don't know Don't know | 9. | 1009 12.729379 1 No Refused No | 10. | 1010 13.667414 1 No No Refused | |----------------------------------------------------------------| 11. | 1011 13.124903 1 No Yes Yes | 12. | 1012 13.391117 1 No Don't know No | +----------------------------------------------------------------+

. li id obsw cluster x1-x3 in 1/12, nolab

+-------------------------------------------+ | id obsw cluster x1 x2 x3 | |-------------------------------------------| 1. | 1001 13.823839 1 1 8 7 | 2. | 1002 12.876063 1 1 1 1 | 3. | 1003 16.9282 1 1 1 9 | 4. | 1004 16.752894 1 1 1 7 | 5. | 1005 13.399568 1 2 9 2 | |-------------------------------------------| 6. | 1006 14.806043 1 7 1 2 | 7. | 1007 13.447599 1 1 1 2 | 8. | 1008 18.986893 1 2 9 9 | 9. | 1009 12.729379 1 2 7 2 | 10. | 1010 13.667414 1 2 2 7 | |-------------------------------------------| 11. | 1011 13.124903 1 2 1 1 | 12. | 1012 13.391117 1 2 9 2 | +-------------------------------------------+

. lab li yesno yesno: 1 Yes 2 No 7 Refused 8 N/A 9 Don't know

You want to convert your data to missing values, so that you can smoothly run your analyses, but you don't want to lose your information on what the particular missing data means. If you {help:mvdecode} your data, your labels are lost:

. mvdecode x* , mv(7 = .a \ 8 = .b \ 9 = .c ) x1: 1 missing value generated x2: 5 missing values generated x3: 5 missing values generated

. li id obsw cluster x1-x3 in 1/12

+----------------------------------------------+ | id obsw cluster x1 x2 x3 | |----------------------------------------------| 1. | 1001 13.823839 1 Yes .b .a | 2. | 1002 12.876063 1 Yes Yes Yes | 3. | 1003 16.9282 1 Yes Yes .c | 4. | 1004 16.752894 1 Yes Yes .a | 5. | 1005 13.399568 1 No .c No | |----------------------------------------------| 6. | 1006 14.806043 1 .a Yes No | 7. | 1007 13.447599 1 Yes Yes No | 8. | 1008 18.986893 1 No .c .c | 9. | 1009 12.729379 1 No .a No | 10. | 1010 13.667414 1 No No .a | |----------------------------------------------| 11. | 1011 13.124903 1 No Yes Yes | 12. | 1012 13.391117 1 No .c No | +----------------------------------------------+

Here's how labelmiss fixes it:

. labelmiss .a "Refused" .b "N/A" .c "Don't know" , modify

. li id obsw cluster x1-x3 in 1/12

+----------------------------------------------------------------+ | id obsw cluster x1 x2 x3 | |----------------------------------------------------------------| 1. | 1001 13.823839 1 Yes N/A Refused | 2. | 1002 12.876063 1 Yes Yes Yes | 3. | 1003 16.9282 1 Yes Yes Don't know | 4. | 1004 16.752894 1 Yes Yes Refused | 5. | 1005 13.399568 1 No Don't know No | |----------------------------------------------------------------| 6. | 1006 14.806043 1 Refused Yes No | 7. | 1007 13.447599 1 Yes Yes No | 8. | 1008 18.986893 1 No Don't know Don't know | 9. | 1009 12.729379 1 No Refused No | 10. | 1010 13.667414 1 No No Refused | |----------------------------------------------------------------| 11. | 1011 13.124903 1 No Yes Yes | 12. | 1012 13.391117 1 No Don't know No | +----------------------------------------------------------------+

. lab li yesno yesno: 1 Yes 2 No 7 Refused 8 N/A 9 Don't know .a Refused .b N/A .c Don't know

We have relabeled all the data, and the variables like id, cluster and obsw have received the default label misslab:

. d id obsw cluster x1-x3

storage display value variable name type format label variable label ------------------------------------------------------------------------------- id int %10.0g misslab Personal ID obsw double %10.0g misslab Ultimate weight cluster byte %10.0g misslab PSU x1 byte %10.0g yesno Item 1 x2 byte %10.0g yesno Item 2 x3 byte %10.0g yesno Item 3

To get rid of this probably undesirable effect, we should have specified

. labelmiss x* .a "Refused" .b "N/A" .c "Don't know" , modify

Most of the time, the variables that you may want to leave untouched are in the beginning of the data set. If they are not, you can move them forward with order. Also, if you want to keep the order of the variables, modfiy most of your variables, and leave some intact, you can use dellist from Nick J. Cox's listutil suite of list utilities:

. unab mylist : _all

. dellist mylist , delete(id cluster obsw) exact

. labelmiss `mylist' .a "Refused" .b "N/A" .c "Don't know" , modify

Author

Stas Kolenikov, skolenik@unc.edu

See also

Online: help for missing, label, mvdecode