I don’t think most people know this. The U.S. flag code changed in 2008. Veterans can keep their hats on and render a salute during the National Anthem. I do.
4 U.S. Code § 9 – Conduct during hoisting, lowering or passing of flag
During the ceremony of hoisting or lowering the flag or when the flag is passing in a parade or in review, all persons present in uniform should render the military salute. Members of the Armed Forces and veterans who are present but not in uniform may render the military salute. All other persons present should face the flag and stand at attention with their right hand over the heart, or if applicable, remove their headdress with their right hand and hold it at the left shoulder, the hand being over the heart. Citizens of other countries present should stand at attention. All such conduct toward the flag in a moving column should be rendered at the moment the flag passes.