Health, social and economic consequences of dementias: a comparative national cohort study