Without more info about what you're data looks like, I can't really help you. The reasons it could be printing blank are uncountable. What I've done here works. See if you can adapt to how you need.
proc format cntlout=icdgrpfmt(keep=fmtname start end label hlo
where=(fmtname='ICDGRP'));
value $icdgrp 'A000'-'A099'='Intestinal_infection' 'A150'-'A199'='TB'
'A200'-'A280'='Zoonotic' 'A300'-'A499'='Other_bacterial' 'A500'-'A640'='STI'
'A650'-'A699'='Spirochaetal' 'A800'-'A890'='Viral_CNS'
'A900'-'A990'='Viral-fever' 'B000'-'B099'='Viral_skin'
'B150'-'B199'='Viral_hep' 'B200'-'B240'='HIV' 'B250'-'B349'='Other_viral'
'B350'-'B490'='Mycoses' 'B500'-'B640'='Protozoa'
'B650'-'B839'='Helminthiases' 'B850'-'B890'='Other_infestation'
'B900'-'B949', 'Y100'-'Y989'='Sequelae' 'B950'-'B990'='Other'
'C000'-'C970'='Neoplasms' 'D000'-'D489'='Other_neoplasms'
'D500'-'D899'='Blood_disorder' 'E000'-'E899'='Endocrine'
'F000'-'F990'='Mental_disorder' 'G000'-'G998'='Nervous'
'H000'-'H599'='Eye_adnexa' 'H600'-'H959'='Ear_mastoid'
'1000'-'1990'='Circulatory' 'J000'-'J998'='Respiratory'
'K000'-'K938'='Digestive' 'L000'-'L998'='Subcutanous' 'M000'-'M999'='MSK'
'N000'-'N999'='Genitourinary' 'O000'-'O998'='Pregnancy'
'P000'-'P969'='Perinatal' 'Q000'-'Q999'='Congenital'
'R000'-'R999'='Clinical_laboratory' 'S0000'-'S9999'='Injuries'
'T0000'-'T983'='Multiple_injuries' 'V010'-'V990'='Transport_accident'
'W000'-'W990'='Other_accidents' 'X000'-'X840'='Other_injuries'
'Z000'-'Z999'='Potential_hazard' other='Ungrouped';
run;
data icdregrp;
retain fmtname '$rgrp' type 'c';
set icdgrpfmt(drop=start end fmtname rename=label=old_label);
start=old_label;
length label $50.;
if start=' ' then
label=' ';
else if start in ('Intestinal_infection', 'TB', 'Zoonotic', 'Other_bacterial',
'STI', 'Spirochaetal', 'Viral_CNS', 'Viral-fever', 'Viral_skin', 'Viral_hep',
'HIV', 'Other_viral', 'Mycoses', 'Protozoa', 'Helminthiases',
'Other_infestation', 'Sequelae', 'Other') then
label='Infections';
else if start in ('Neoplasms', 'Other_neoplasms') then
label='Neoplasm';
else if start in ('Blood_disorder') then
label='Blood_dis';
else if start in ('Endocrine') then
label='Endocrine';
else if start in ('Mental_disorder') then
label='Mental_dis';
else if start in ('Nervous') then
label='Nervous';
else if start in ('Eye_adnexa') then
label='Adnexa';
else if start in ('Ear_mastoid') then
label='Ear_mast';
else if start in ('Circulatory') then
label='Circulatory';
else if start in ('Respiratory') then
label='Respiration';
else if start in ('Digestive') then
label='Digestive';
else if start in ('Subcutanous') then
label='Subcutanous';
else if start in ('MSK') then
label='MSK';
else if start in ('Genitourinary') then
label='Genitourinary';
else if start in ('Pregnancy') then
label='Pregnancy';
else if start in ('Perinatal') then
label='Perinatal';
else if start in ('Congenital') then
label='Congenital';
else if start in ('Clinical_laboratory') then
label='Clinical_laboratory';
else if start in ('Injuries', 'Multiple_injuries', 'Transport_accident',
'Other_accidents', 'Other_injuries') then
label='Injuries';
else if start in ('Potential_hazard', 'Ungrouped') then
label='Other';
drop old_label;
run;
proc sort data=icdregrp nodupkey out=regrp;
by start;
run;
proc format cntlin=regrp;
run;
data have;
input icd_cd $;
datalines;
A096
B955
;
run;
data want;
set have;
icd_grp_fmt=put(icd_cd, $icdgrp.);
icd_regrp_fmt=put(icd_grp_fmt, $rgrp.);
run;
... View more