Say, we have:
label define boolean 0 "no" 1 "yes"
To have more readable code, I would like to be able to write:
gen boolean x = "no"
replace x = "yes" if y > 50
x would still be a numeric variable (having 0's and 1's in this case), but stata would be able to detect that you're using strings, so needs to make a translation using the defined value label.
If that is not possible, it would also be very helpful to have an option to display both value and label in the same command, like:
tab x, valueAndLabel
Right now, when you need do data manipulations, you first need to find out where things are going wrong, then need to find out the matching code for that, eg:
tab x
tab x, nolabel
That is cumbersome. But if we could just use labels in code, the underlying values are not needed anymore at all, which would remove the need to know codes of value labels.
label define boolean 0 "no" 1 "yes"
To have more readable code, I would like to be able to write:
gen boolean x = "no"
replace x = "yes" if y > 50
x would still be a numeric variable (having 0's and 1's in this case), but stata would be able to detect that you're using strings, so needs to make a translation using the defined value label.
If that is not possible, it would also be very helpful to have an option to display both value and label in the same command, like:
tab x, valueAndLabel
Right now, when you need do data manipulations, you first need to find out where things are going wrong, then need to find out the matching code for that, eg:
tab x
tab x, nolabel
That is cumbersome. But if we could just use labels in code, the underlying values are not needed anymore at all, which would remove the need to know codes of value labels.
Comment