Conduct during a rendition of the national anthem when the flag is displayed:
(A) individuals in uniform should give the military salute at the first note of the anthem and maintain that position until the last note;
(B) members of the Armed Forces and veterans who are present but not in uniform may render the military salute in the manner provided for individuals in uniform; and
(C) all other persons present should face the flag and stand at attention with their right hand over the heart, and men not in uniform, if applicable, should remove their headdress with their right hand and hold it at the left shoulder, the hand being over the heart; 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.
The key word here is "should," according to legal experts, which stops short of "shall" or "must."
The passage is part of the larger U.S Flag Code, which prescribes American flag and National Anthem etiquette. However, as a 2007 report to Congress noted, the code "does not prescribe any penalties for non-compliance" and "functions simply as a guide to be voluntarily followed by civilians and civilian groups."
In other words, it's not against the law to sit out the National Anthem, however controversial it might be.