Bhagavad Gita 5.23

शक्नोतिहैव य: सोढुं प्राक्शरीरविमोक्षणात् |
कामक्रोधोद्भवं वेगं स युक्त: स सुखी नर:

Translation

Those persons are yogis, who before giving up the body are able to check the forces of desire and anger; and they alone are happy.