SELECT
	UCOD,
	(CASE 
		WHEN UCOD between 'I000' and 'I099' OR UCOD between 'I110' and 'I119' or UCOD between 'I130' and 'I149' OR UCOD between 'I200' and 'I519'
			THEN 1
		WHEN UCOD between 'C000' and 'C979' 
			THEN 2
		WHEN UCOD between 'J100' and 'J200' OR UCOD = 'J09-' 
			THEN 3
		WHEN UCOD between 'E100' and 'E149' 
			THEN 4
		WHEN UCOD between 'J400' and 'J479' or UCOD = 'J40-' 
			THEN 5
		WHEN UCOD like 'I6%[0-99]' 
			THEN 6
		WHEN UCOD between 'V010' and 'X388' or UCOD in ('X43-', 'X45-') or UCOD between 'X450' and 'X599' or UCOD between 'Y850' and 'Y869' 
			THEN 7
		WHEN UCOD = 'I10-' or UCOD between 'I100' and 'I110' or UCOD between 'I120' and 'I130' 
			THEN 8
		WHEN UCOD between 'F110' and 'F159' or UCOD between 'F180' and 'F199' or UCOD between 'X400' and 'X428' or UCOD in ('X40-', 'X44-') 
			then 9
		WHEN UCOD between 'B200' and 'B249' 
			THEN 10
		WHEN UCOD between 'G300' and 'G309'
			THEN 11
		WHEN UCOD between 'K700' and 'K710' or UCOD between 'K730' and 'K749' 
			THEN 12
		WHEN UCOD between 'X600' and 'X849' or UCOD in ('X60-', 'SU1', 'Y870') 
			THEN 13
		WHEN UCOD between 'N000' and 'N070' or UCOD between 'N170' and 'N199' or UCOD between'N250'and 'N269' 
			THEN 14	
		WHEN UCOD between 'X850' and 'Y099' or UCOD in ('X85-', 'HM1') 
			THEN 15 
		ELSE 16 
	END) AS COD,

	(case when Age_Group_Recode < 6 then 1 end) as Premature,
	(case when UCOD like 'I21%' or UCOD LIKE 'I22%' THEN 1 END) as [Myocardial_Infarction]
FROM DeathStatisticalExtractData

