I don't think its mandatory. Some forums advise on writing the social security number, some I have read say its not necessary.Its really upto the person who writes the affadavit if they want to disclose that information or not.
The friends of ours who wrote an affadavit for us said they did not feel comfortable revealing the social security numbers. So, I just asked them to omit it. As long as the letter has necessary details on how they know you as couple, how long, how did they meet you and other information to support it, you should be fine.
I sent in 3 letters from different friends and family members instead of the required 2 along with the other supporting documents.