Hello!
New user here. I had 28 string variables with similar data that I encoded to numeric, using a defined value label (SIRorder).
. label define SIRorder 1 "S" 2 "I" 3 "R" 4 "NI" 5 "NA" 6 "NULL"
example:
. encode AugNEW , generate(Aug_new2) label(SIRorder)
I used the value label because not all of the original string variables had each of the data categories, and this gave me more consistency in how the data are encoded. None of the variables have any blank or missing data; the equivalent of missing in the string variables was originally coded as "NULL." In encoding the string variables, I now have a category (#6) for "NULL."
. label list SIRorder
SIRorder:
1 S
2 I
3 R
4 NI
5 NA
6 NULL
7 NB
How can I indicate that I want #6 to be treated as missing for all variables I generated using the value label SIRorder? It won't let me redefine #6 as missing:
. label define SIRorder . == 6, modify
may not label .
r(198);
Should I (could I?) have encoded NULL as missing when I originally encoded the string variables to numeric?
I could go through each of the 28 new variables and replace #6 with missing, but that seems like a lot of manual work. I may also ultimately want to make SIRorder categories #4, #5, and #7 also be missing (.), so understanding how best to do this for #6 will potentially be useful down the road.
Thanks in advance for your patience and help!
Edie Marshall
New user here. I had 28 string variables with similar data that I encoded to numeric, using a defined value label (SIRorder).
. label define SIRorder 1 "S" 2 "I" 3 "R" 4 "NI" 5 "NA" 6 "NULL"
example:
. encode AugNEW , generate(Aug_new2) label(SIRorder)
I used the value label because not all of the original string variables had each of the data categories, and this gave me more consistency in how the data are encoded. None of the variables have any blank or missing data; the equivalent of missing in the string variables was originally coded as "NULL." In encoding the string variables, I now have a category (#6) for "NULL."
. label list SIRorder
SIRorder:
1 S
2 I
3 R
4 NI
5 NA
6 NULL
7 NB
How can I indicate that I want #6 to be treated as missing for all variables I generated using the value label SIRorder? It won't let me redefine #6 as missing:
. label define SIRorder . == 6, modify
may not label .
r(198);
Should I (could I?) have encoded NULL as missing when I originally encoded the string variables to numeric?
I could go through each of the 28 new variables and replace #6 with missing, but that seems like a lot of manual work. I may also ultimately want to make SIRorder categories #4, #5, and #7 also be missing (.), so understanding how best to do this for #6 will potentially be useful down the road.
Thanks in advance for your patience and help!
Edie Marshall