options ls=80; libname save '/temp/frl1'; data tree; infile '/temp/frl1/tree' dlm=';'; length old $9. nname $30.; input id nname $ old $; code=compress(old,'-')+0; disease=((id ge 7049) and (id le 9949)); blood=((id ge 7050) and (id le 7211)); calcium=((id ge 7212) and (id le 7225)); cardio=((id ge 7226) and (id le 7390)); commun1=((id ge 7391) and (id le 7599)); commun2=((id ge 7600) and (id le 7622)); congen=((id ge 7623) and (id le 7728)); connect=((id ge 7729) and (id le 7752)); digest=((id ge 7753) and (id le 7934)); ear=((id ge 7935) and (id le 7954)); endocrin=((id ge 7955) and (id le 8053)); enzyme=(id eq 8054); eye=((id ge 8055) and (id le 8137)); genetic=((id ge 8138) and (id le 8148)); hernia=(id eq 8149); immuno=((id ge 8150) and (id le 8235)); infect=((id ge 8236) and (id le 8335)); injury=((id ge 8336) and (id le 8372)); lymph=((id ge 8373) and (id le 8436)); mental=((id ge 8437) and (id le 8553)); metab=((id ge 8554) and (id le 8805)); musculo=((id ge 8806) and (id le 8899)); neoplasm=((id ge 8900) and (id le 9150)); nervous=((id ge 9151) and (id le 9387)); nutri1=((id ge 9388) and (id le 9391)); nutri2=((id ge 9392) and (id le 9423)); orphan=(id eq 9424); pathol=((id ge 9425) and (id le 9574)); plant=((id ge 9575) and (id le 9576)); postnat=(id eq 9577); pregnan=((id ge 9578) and (id le 9591)); reprod=((id ge 9592) and (id le 9696)); respir=((id ge 9697) and (id le 9796)); skin=((id ge 9797) and (id le 9862)); syndrome=((id ge 9863) and (id le 9866)); urinary=((id ge 9867) and (id le 9949)); keep code nname disease blood calcium cardio commun1 commun2 congen connect digest ear endocrin enzyme eye genetic hernia immuno infect injury lymph mental metab musculo neoplasm nervous nutri1 nutri2 orphan pathol plant postnat pregnan reprod respir skin syndrome urinary; proc summary nway;class code;var disease blood calcium cardio commun1 commun2 congen connect digest ear endocrin enzyme eye genetic hernia immuno infect injury lymph mental metab musculo neoplasm nervous nutri1 nutri2 orphan pathol plant postnat pregnan reprod respir skin syndrome urinary; output out=tree2 max=; filename hist '~/crisp/hist.as2'; data a;infile hist length=l missover; input @1 first_yr 2. @4 last_yr 2. @8 old $9.; length=l; code=compress(old,'-')+0; if length=1 then n+1;if length gt 1; keep n first_yr last_yr code; data d95;set a;if first_yr le 95 and last_yr ge 95;rename code=code95; data d96;set a;if first_yr le 96 and last_yr ge 96; proc summary nway data=a;by n;var first_yr last_yr; output out=c min(first_yr)=begin max(last_yr)=end; data both;merge d95 d96 c; by n; post80=(begin gt 80); keep code95 code begin post80; proc sort;by code95; data a; infile '/temp/frl1/FY1995' missover; length x $80 pi $30 org $40 first4 $4 next4 $4 name $50; input x & @; first4=substr(x,1,4); next4=substr(x,5,4); fy=index(x,'FY '); award1=index(x,'AWARD AMOUNT..'); org1=index(x,'PERFORMING'); if fy then do;input @55 PI $ &;n+1;end; else if award1 then input @22 amount $11.; else if org1 then input @26 org $ &; else if first4 ge '0000' and first4 le '9999' then input @5 old $9. @15 type $1. @17 name & $; else input; *keep fy pi n award1 org1 code type name; *proc contents; data code;set a;if old ne ' '; code95=compress(old)+0; keep code95 type name n; data pi;set a;if fy;keep n pi; data amount;set a;if award1; dollars=compress(amount,'$ ,')+0; keep n dollars; data org;set a;if org1;keep n org; data new;merge pi amount org;by n; if first.n; data new;merge code new;by n; proc sort;by code95; data new;merge new(in=in1) both;by code95;if in1; proc sort;by code; data new;merge new(in=in1) tree2;by code;if in1; proc sort;by n code; data new;set new;by n code;if first.code; proc chart;hbar begin/type=freq discrete; proc summary nway;class n;var dollars post80 disease blood calcium cardio commun1 commun2 congen connect digest ear endocrin enzyme eye genetic hernia immuno infect injury lymph mental metab musculo neoplasm nervous nutri1 nutri2 orphan pathol plant postnat pregnan reprod respir skin syndrome urinary; output out=save.new2 max( disease blood calcium cardio commun1 commun2 congen connect digest ear endocrin enzyme eye genetic hernia immuno infect injury lymph mental metab musculo neoplasm nervous nutri1 nutri2 orphan pathol plant postnat pregnan reprod respir skin syndrome urinary)= mean(dollars post80)=; *proc print; proc means n mean sum min max; proc means n mean sum min max; weight dollars; proc chart;hbar disease blood calcium cardio commun1 commun2 congen connect digest ear endocrin enzyme eye genetic hernia immuno infect injury lymph mental metab musculo neoplasm nervous nutri1 nutri2 orphan pathol plant postnat pregnan reprod respir skin syndrome urinary/sumvar=post80 type=mean discrete; /* proc print data=new;by n; var code disease name nname pi dollars;