Reported Speech: He said, "I was sad"
Solution 1:
The past perfect continuous form is: Subject + had been + infinitive + ing.
For example: he had been learning.
Had been sad is past perfect.
The correct answers for the given sentences are:
He said, "I was sad."
He said (that) he was sad.
He said (that) he had been sad.
Both the answers are correct.
Raymond Murphy and Michael Swan in their grammar books say that the simple past in direct speech may be or may not be changed into past perfect for indirect speech.