It's the law to remove ones hat and place their right hand over their heart:
http://uscode.house.gov/download/pls/36C3.txt
-HEAD-
Sec. 301. National anthem
-STATUTE-
(a) Designation. - The composition consisting of the words and
music known as the Star-Spangled Banner is the national anthem.
(b) Conduct During Playing. - During a rendition of the national
anthem -
(1) when the flag is displayed -
(A) all present except those in uniform should stand at
attention facing the flag with the right hand over the heart;
(B) men not in uniform should remove their headdress with
their right hand and hold the headdress at the left shoulder,
the hand being over the heart; and
(C) individuals in uniform should give the military salute at
the first note of the anthem and maintain that position until
the last note; and
(2) when the flag is not displayed, all present should face
toward the music and act in the same manner they would if the
flag were displayed.