In this secondary analysis of multicenter retrospective real‐world data, we examined whether an existing anxiety or depression diagnosis was associated with the safety and efficacy of anti‐PD‐1 or anti‐PD‐L1 monotherapy across cancer types. This evidence concerns the gene CD274 and depressive symptom measurement.