Anomaly matching across dimensions and supersymmetric Cardy formulae