Code:
* Example generated by -dataex-. For more info, type help dataex clear input str5 var1 float var2 "<0.50" .25 "<1.10" .55 "<0.50" .25 "<1.00" .5 "<0.50" .25 "<1.20" .6 "<0.50" .25 "<1.00" .5 "<0.30" .15 "0.50" .5 end
the var2 is the target var from var1, how to remove the "<" sign and at the same time divide the value after the "<" sign by 2
i can remove the "<" sign by the command as follows:
gen var3 = ""
replace var3 = regexr(var1, "^<", "")
but how to divide the value by 2 at the same time
Thank you very much!
Comment