BackgroundAnxiety disorders are prevalent in patients with myocardial infarction (MI), but the effects of anxiety disorders on in‐hospital outcomes within MI patients have not been well studied.HypothesisTo examine the effects of concurrent anxiety disorders on in‐hospital outcomes in MI patients.MethodsWe conducted a retrospective cohort study in patients with a principal diagnosis of MI with and without anxiety disorders in the National Inpatient Sample 2016. A total of 129 305 primary hospitalizations for acute MI, 35 237 with ST‐segment elevation myocardial infarction (STEMI), and 94 068 with non‐ST elevation myocardial infarction (NSTEMI) were identified. Of these, 13 112 (10.1%) had anxiety (7.9% in STEMI and 11.0% in NSTEMI). We compared outcomes of anxiety and nonanxiety groups after propensity score matching for the patient and hospital demographics and relevant comorbidities.ResultsAfter propensity score matching, the anxiety group had a lower incidence of in‐hospital mortality (3.0% vs 4.4%, P < .001), cardiac arrest (2.1% vs 2.8%, P < .001), cardiogenic shock (4.9% vs 5.6%, P = .007), and ventricular arrhythmia (6.7% vs 7.9%, P < .001) than the nonanxiety group. In the NSTEMI subgroup, the anxiety group had significantly lower rates of in‐hospital mortality (2.3% vs 3.5%, P < .001), cardiac arrest (1.1% vs 1.5%, P = .008), and cardiogenic shock (2.8% vs 3.5%, P = .008). In the STEMI subgroup, we found no differences in in‐hospital outcomes (all P > .05) between the matched groups.ConclusionAlthough we found that anxiety was associated with better in‐hospital outcomes, subgroup analysis revealed that this only applied to patients admitted for NSTEMI instead of STEMI.