Hello,
I would like to modify value labels of a variable when I know the labels but not necessarily the underlying values to which they correspond. In my case the underlying value is not important and may change, and the code should be agnostic to this. Based on Stata Tip 14: "Using value labels in expressions", I hoped something like this would work:
label define gender "F":gender "Girls", modify
where I expect the piece "F":gender to return the value that F is a label for, and the command as a whole would then relabel F to Girls. But this does not work and Stata complains that I'm using "invalid syntax". What am I missing or how else could this be done?
Best regards,
Momar
I would like to modify value labels of a variable when I know the labels but not necessarily the underlying values to which they correspond. In my case the underlying value is not important and may change, and the code should be agnostic to this. Based on Stata Tip 14: "Using value labels in expressions", I hoped something like this would work:
label define gender "F":gender "Girls", modify
where I expect the piece "F":gender to return the value that F is a label for, and the command as a whole would then relabel F to Girls. But this does not work and Stata complains that I'm using "invalid syntax". What am I missing or how else could this be done?
Best regards,
Momar
Comment