The easiest one is creating a non persistent object with a string inside. Pass the object containing the SSN to a datasource microflow. In the microflow create the non persistant object. Now use substring to cut the SSN value in two and use the replaceAll command (https://docs.mendix.com/refguide/string-function-calls#replaceall) to change all the number values for asteriks. Then combine the two again and place them inside the string of the non persistent object and let the microflow return that object.
Regards,
Ronald