MergeField.subString

I’m trying to create a template using IRS W9 and the SSN field is broken up into three fields. The data stored is the hyphenated SSN. I would like to extract the specific substrings of the SSN for a mailmerge template. How can I use functions in the merge?