While debugging the failure of value labels to be assigned to some variables in a long syntax file, I discovered that -label values- does not complain if given a non-existent (likely misspelled) label name. It assigns a value label with no content to the variable, which removes any existing label:
I suppose this behavior could be regarded as desirable, as it means that a labeling mistake doesn't break syntax, but it's undesirable in a) failing to help one discover a spelling or other error, and b) allowing one to remove a good label by accident. This is clearly not a big deal, and might even be documented, but perhaps having heard about this will save someone else a similar confusion.
Code:
sysuse auto, clear gen byte x = runiform() > 0.6 label values x origi // non-existing label, truncated/misspelled existing value label desc x tab x // tab foreign, label label values foreign MyMistake tab foreign, label
Comment