Hello,
I have a variable that captures data on various measures of accuracy, including standard errors and confidence intervals. The variable includes negative numbers on their own, and for confidence intervals, negative numbers are sometimes paired with hyphens to separate lower and upper confidence intervals. I've been unable to figure out a way to create a variable that removes the hyphens without removing the negative sign. Splitting the variable and ignoring the hyphen won't work. I also found this code on a website to tag negative values, but found that this doesn't work either.
gen tagonenegative = regexm(moavalue_c11, "^-[.0-9])")
Here are some values from the variable as an example (I'm including only a few) :
moavalue_c11
-.14
-0.12-0.14
.00345
0.09–0.98
0.687–1.012
-0.270
Any help with this would be greatly appreciated!
Thanks,
Fatima
I have a variable that captures data on various measures of accuracy, including standard errors and confidence intervals. The variable includes negative numbers on their own, and for confidence intervals, negative numbers are sometimes paired with hyphens to separate lower and upper confidence intervals. I've been unable to figure out a way to create a variable that removes the hyphens without removing the negative sign. Splitting the variable and ignoring the hyphen won't work. I also found this code on a website to tag negative values, but found that this doesn't work either.
gen tagonenegative = regexm(moavalue_c11, "^-[.0-9])")
Here are some values from the variable as an example (I'm including only a few) :
moavalue_c11
-.14
-0.12-0.14
.00345
0.09–0.98
0.687–1.012
-0.270
Any help with this would be greatly appreciated!
Thanks,
Fatima
Comment