I have a dummy dataset that looks like the following:
And I am trying to use the below code in order to drop the last 0 from each observation. I took this line of code from here: Stata | FAQ: Removing leading or trailing zeros from string variables
replace varlist = usubstr(varlist, 1, ustrlen(varlist) − 1) if usubstr(varlist,−1,1) == "0"
However when I run this I get the following error message:
unknown function ()
r(133);
Any advice would be much appreciated.
BW,
Jenna
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str7 varlist "A111110" "A11110" "A1110" "A110" "A10" "A10110" "A1010" "A111000" "A1100" end
replace varlist = usubstr(varlist, 1, ustrlen(varlist) − 1) if usubstr(varlist,−1,1) == "0"
However when I run this I get the following error message:
unknown function ()
r(133);
Any advice would be much appreciated.
BW,
Jenna
Comment