Stata Random Tips

Tip # 1 : Extract all text from a macro after a specific letter

Say that we have the following macro

local sp stata.professor

we want to extract anything that comes after the period (.), we can use the following code:

loc var =substr("`sp",strpos("`sp'",".")+1,.)
dis "`var'"