Ches Zin you have several posts on Statalist now, so provide proper dataex examples in your future posts. You need to enclose the match within parentheses. Otherwise use -ustrregexs(0)-
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str44 doser " 1 tablet when needed . Max 8 tablet per day" end gen max1= ustrregexs(0) if ustrregexm(lower(doser),"max [0-9]") gen max2= ustrregexs(1) if ustrregexm(lower(doser),"(max [0-9])")
Comment