Self-sacrifice is certainly a virtue. Look at Rebecca Nurse, the epitome of Good. She gives her life for telling the truth. Proctor does as well...it's sort of a penalty to make up for his former sins.
John Proctor is a leader, he is a man who only takes action based on his belief and he is also an honest person.
Proctor is a good and noble man and because of this he believes at first he can't be hanged and die a martyr when he has this sin blooming over him every waking moment . John later says to Elizabeth that " My honesty is broke, Elizabeth; I am no good man.
Nothing's spoiled by giving them this lie that were not rotten long before"(136) and rather confess then die for something he flat out didn't do. However, as John confesses, he can not allow Danforth to make it officially documented.
As Danforth asks him why John answers with a cry " because it is my name. Because I cannot have another in my life . . . How may I live without my name? Have given you my soul; leave me my name(143). John feels strongly about having a good name and not dying with a bad one. Proctor weighs both sides of his internal conflict and realizes that he must not make another mistake.
He therefore, prescribes himself to death, not for his own sake, but rather for the sake of the others.