Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGP9DP4

BGP9DP4.m

Go to the documentation of this file.
BGP9DP4 ; IHS/CMI/LAB - print ind 31 ;
 ;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
 ;
 ;
I031 ;EP
 S BGPORXX=$P(^BGPINDN(BGPIC,0),U,6)
 D H1^BGP9DPH
 I BGPRTYPE=4,BGPINDT="C" D  Q
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".7.3D",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".8.3D",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".9.3D",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".7.3E",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".8.3E",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".9.3E",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".7.3F",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".8.3F",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".9.3F",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".7.3G",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".8.3G",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".9.3G",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".7.3H",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".8.3H",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 .S BGPDENP=0 S BGPPC=$O(^BGPINDNC("OR",BGPORXX_".9.3H",0)) D PI1^BGP9DP1C
 .Q:BGPQUIT
 F BGPPC1=BGPORXX_".1",BGPORXX_".2",BGPORXX_".3" Q:BGPQUIT  D PI^BGP9DP1C
 Q:BGPQUIT
 I BGPRTYPE=4 W:'$G(BGPSUMON) !
 F BGPPC1=BGPORXX_".4",BGPORXX_".5",BGPORXX_".6" Q:BGPQUIT  D PI^BGP9DP1C
 D I1AGE
 Q:BGPQUIT
 Q
I1AGE ;EP special age tallies
 ;Q:BGPRTYPE'=4
 I BGPINDT="W",BGPRTYPE=4 G FEM
 S BGPHD1="TOTAL ACTIVE CLINICAL POPULATION",BGPHD2="Total # Active Clin",BGPHD3=""
 I '$G(BGPSUMON) D HEADER^BGP9DPH Q:BGPQUIT  W !,^BGPINDN(BGPIC,53,1,0) W:$D(^BGPINDN(BGPIC,53,2,0)) !,^BGPINDN(BGPIC,53,2,0)  D H3
 K BGPDAC,BGPDAP,BGPDAB S (C,D)=0 F BGPX="CD","CG","CJ","CM","CP","CS","CV","CY" D I1AGE1,I1AGE2
 D I1AGEP
 ;Q:BGPRTYPE'=4
 Q:BGPQUIT
 S BGPHD1="MALE ACTIVE CLINICAL POPULATION",BGPHD2="Total MALE AC",BGPHD3=""
 I '$G(BGPSUMON) D HEADER^BGP9DPH Q:BGPQUIT  W !,^BGPINDN(BGPIC,53,1,0) W:$D(^BGPINDN(BGPIC,53,2,0)) !,^BGPINDN(BGPIC,53,2,0)  D H3
 K BGPDAC,BGPDAP,BGPDAB S (D,C)=0 F BGPX="CE","CH","CK","CN","CQ","CT","CW","CZ" D I1AGE1,I1AGE2
 D I1AGEP
 Q:BGPQUIT
FEM ;
 S BGPHD1="FEMALE ACTIVE CLINICAL POPULATION",BGPHD2="Total FEMALE AC",BGPHD3=""
 I '$G(BGPSUMON) D HEADER^BGP9DPH Q:BGPQUIT  W !,^BGPINDN(BGPIC,53,1,0) W:$D(^BGPINDN(BGPIC,53,2,0)) !,^BGPINDN(BGPIC,53,2,0)  D H3
 K BGPDAC,BGPDAP,BGPDAB S (C,D)=0 F BGPX="CF","CI","CL","CO","CR","CU","CX","DA" D I1AGE1,I1AGE2
 D I1AGEP
 K BGPHD3
 Q
I1AGE1 ;
 ;gather up all #'s
 S C=C+1
 S BGPF="031."_BGPX_".1" S BGPPC=$O(^BGPINDNC("C",BGPF,0))
 S BGPDF=$P(^BGPINDNC(BGPPC,0),U,8)
 S BGPNP=$P(^DD(90536.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 S $P(BGPDAC(C),U)=$$V^BGP9DP1C(1,BGPRPT,N,P)
 S $P(BGPDAP(C),U)=$$V^BGP9DP1C(2,BGPRPT,N,P)
 S $P(BGPDAB(C),U)=$$V^BGP9DP1C(3,BGPRPT,N,P)
 ;set 2nd piece to numerator and 3rd to %
 S BGPNF=$P(^BGPINDNC(BGPPC,0),U,9)
 S BGPNP=$P(^DD(90536.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 S $P(BGPDAC(C),U,2)=$$V^BGP9DP1C(1,BGPRPT,N,P),$P(BGPDAC(C),U,3)=$S($P(BGPDAC(C),U,1):($P(BGPDAC(C),U,2)/$P(BGPDAC(C),U)*100),1:"")
 S $P(BGPDAP(C),U,2)=$$V^BGP9DP1C(2,BGPRPT,N,P),$P(BGPDAP(C),U,3)=$S($P(BGPDAP(C),U,1):($P(BGPDAP(C),U,2)/$P(BGPDAP(C),U)*100),1:"")
 S $P(BGPDAB(C),U,2)=$$V^BGP9DP1C(3,BGPRPT,N,P),$P(BGPDAB(C),U,3)=$S($P(BGPDAB(C),U,1):($P(BGPDAB(C),U,2)/$P(BGPDAB(C),U)*100),1:"")
 Q
I1AGE2 ;
 S D=D+1
 S BGPF="031."_BGPX_".2" S BGPPC=$O(^BGPINDNC("C",BGPF,0))
 ;set 4th piece to numerator and 5th to %
 S BGPNF=$P(^BGPINDNC(BGPPC,0),U,9)
 S BGPNP=$P(^DD(90536.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 S $P(BGPDAC(D),U,4)=$$V^BGP9DP1C(1,BGPRPT,N,P),$P(BGPDAC(D),U,5)=$S($P(BGPDAC(D),U,2):($P(BGPDAC(D),U,4)/$P(BGPDAC(D),U,2)*100),1:"")
 S $P(BGPDAP(D),U,4)=$$V^BGP9DP1C(2,BGPRPT,N,P),$P(BGPDAP(D),U,5)=$S($P(BGPDAP(D),U,2):($P(BGPDAP(D),U,4)/$P(BGPDAP(D),U,2)*100),1:"")
 S $P(BGPDAB(D),U,4)=$$V^BGP9DP1C(3,BGPRPT,N,P),$P(BGPDAB(D),U,5)=$S($P(BGPDAB(D),U,2):($P(BGPDAB(D),U,4)/$P(BGPDAB(D),U,2)*100),1:"")
I1AGE3 ;
 S BGPF="031."_BGPX_".3" S BGPPC=$O(^BGPINDNC("C",BGPF,0))
 ;set 6th piece to numerator and 7th to %
 S BGPNF=$P(^BGPINDNC(BGPPC,0),U,9)
 S BGPNP=$P(^DD(90536.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 S $P(BGPDAC(D),U,6)=$$V^BGP9DP1C(1,BGPRPT,N,P),$P(BGPDAC(D),U,7)=$S($P(BGPDAC(D),U,2):($P(BGPDAC(D),U,6)/$P(BGPDAC(D),U,2)*100),1:"")
 S $P(BGPDAP(D),U,6)=$$V^BGP9DP1C(2,BGPRPT,N,P),$P(BGPDAP(D),U,7)=$S($P(BGPDAP(D),U,2):($P(BGPDAP(D),U,6)/$P(BGPDAP(D),U,2)*100),1:"")
 S $P(BGPDAB(D),U,6)=$$V^BGP9DP1C(3,BGPRPT,N,P),$P(BGPDAB(D),U,7)=$S($P(BGPDAB(D),U,2):($P(BGPDAB(D),U,6)/$P(BGPDAB(D),U,2)*100),1:"")
I1AGE4 ;
 S BGPF="031."_BGPX_".4" S BGPPC=$O(^BGPINDNC("C",BGPF,0))
 ;set 8th piece to numerator and 9th to %
 S BGPNF=$P(^BGPINDNC(BGPPC,0),U,9)
 S BGPNP=$P(^DD(90536.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 S $P(BGPDAC(D),U,8)=$$V^BGP9DP1C(1,BGPRPT,N,P),$P(BGPDAC(D),U,9)=$S($P(BGPDAC(D),U,2):($P(BGPDAC(D),U,8)/$P(BGPDAC(D),U,2)*100),1:"")
 S $P(BGPDAP(D),U,8)=$$V^BGP9DP1C(2,BGPRPT,N,P),$P(BGPDAP(D),U,9)=$S($P(BGPDAP(D),U,2):($P(BGPDAP(D),U,8)/$P(BGPDAP(D),U,2)*100),1:"")
 S $P(BGPDAB(D),U,8)=$$V^BGP9DP1C(3,BGPRPT,N,P),$P(BGPDAB(D),U,9)=$S($P(BGPDAB(D),U,2):($P(BGPDAB(D),U,8)/$P(BGPDAB(D),U,2)*100),1:"")
I1AGE5 ;
 S BGPF="031."_BGPX_".5" S BGPPC=$O(^BGPINDNC("C",BGPF,0))
 ;set 8th piece to numerator and 9th to %
 S BGPNF=$P(^BGPINDNC(BGPPC,0),U,9)
 S BGPNP=$P(^DD(90536.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 S $P(BGPDAC(D),U,10)=$$V^BGP9DP1C(1,BGPRPT,N,P),$P(BGPDAC(D),U,11)=$S($P(BGPDAC(D),U,2):($P(BGPDAC(D),U,10)/$P(BGPDAC(D),U,2)*100),1:"")
 S $P(BGPDAP(D),U,10)=$$V^BGP9DP1C(2,BGPRPT,N,P),$P(BGPDAP(D),U,11)=$S($P(BGPDAP(D),U,2):($P(BGPDAP(D),U,10)/$P(BGPDAP(D),U,2)*100),1:"")
 S $P(BGPDAB(D),U,10)=$$V^BGP9DP1C(3,BGPRPT,N,P),$P(BGPDAB(D),U,11)=$S($P(BGPDAB(D),U,2):($P(BGPDAB(D),U,10)/$P(BGPDAB(D),U,2)*100),1:"")
 Q
I1AGEP ;
 W:'$G(BGPSUMON) !,"CURRENT REPORT PERIOD"
 W:'$G(BGPSUMON) !,BGPHD2 I BGPHD3]"" W:'$G(BGPSUMON) !,?1,BGPHD3
 S T=23 F X=1:1:8 S V=$P(BGPDAC(X),U) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"# w/ BMI calculated"
 S T=23 F X=1:1:8 S V=$P(BGPDAC(X),U,2) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% w/BMI calculated"
 S T=22 F X=1:1:8 S V=$P(BGPDAC(X),U,3) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# A. Overweight"
 S T=23 F X=1:1:8 S V=$P(BGPDAC(X),U,4) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% A. Overweight w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAC(X),U,5) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# B. Obese"
 S T=23 F X=1:1:8 S V=$P(BGPDAC(X),U,6) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% B. Obese w/",!," % of Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAC(X),U,7) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# C. Overweight",!," or Obese"
 S T=23 F X=1:1:8 S V=$P(BGPDAC(X),U,8) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% C. Overweight or Obese w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAC(X),U,9) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# D. w/refusal in",!," in past yr"
 S T=23 F X=1:1:8 S V=$P(BGPDAC(X),U,10) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% D. w/refusal in past yr w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAC(X),U,11) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
PR ; 
 I '$G(BGPSUMON) D HEADER^BGP9DPH Q:BGPQUIT  W !,^BGPINDN(BGPIC,53,1,0) W:$D(^BGPINDN(BGPIC,53,2,0)) !,^BGPINDN(BGPIC,53,2,0) D H3
 W:'$G(BGPSUMON) !!,"PREVIOUS YEAR PERIOD"
 W:'$G(BGPSUMON) !,BGPHD2 I BGPHD3]"" W:'$G(BGPSUMON) !,?1,BGPHD3
 S T=23 F X=1:1:8 S V=$P(BGPDAP(X),U) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"# w/ BMI calculated"
 S T=23 F X=1:1:8 S V=$P(BGPDAP(X),U,2) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% w/BMI calculated"
 S T=22 F X=1:1:8 S V=$P(BGPDAP(X),U,3) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# A. Overweight"
 S T=23 F X=1:1:8 S V=$P(BGPDAP(X),U,4) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% A. Overweight w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAP(X),U,5) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# B. Obese"
 S T=23 F X=1:1:8 S V=$P(BGPDAP(X),U,6) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% B. Obese w/",!," % of Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAP(X),U,7) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# C. Overweight",!," or Obese"
 S T=23 F X=1:1:8 S V=$P(BGPDAP(X),U,8) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% C. Overweight or Obese w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAP(X),U,9) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# D. w/refusal in",!," past yr"
 S T=23 F X=1:1:8 S V=$P(BGPDAP(X),U,10) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% D. w/refusal in past yr w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAP(X),U,11) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
PB ;
 ;percentage changes
 W:'$G(BGPSUMON) !!,"CHANGE FROM PREV YR %"
 W:'$G(BGPSUMON) !,"w/ BMI calculated"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,3),O=$P(BGPDAP(X),U,3) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"A. Overweight"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,5),O=$P(BGPDAP(X),U,5) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"B. Obese"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,7),O=$P(BGPDAP(X),U,7) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"C. Overweight",!," or Obese"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,9),O=$P(BGPDAP(X),U,9) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"D. w/refusal in",!," past yr"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,11),O=$P(BGPDAP(X),U,11) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
BL ;
 I '$G(BGPSUMON) D HEADER^BGP9DPH Q:BGPQUIT  W !,^BGPINDN(BGPIC,53,1,0) W:$D(^BGPINDN(BGPIC,53,2,0)) !,^BGPINDN(BGPIC,53,2,0) D H3
 W:'$G(BGPSUMON) !!,"BASELINE REPORT PERIOD"
 W:'$G(BGPSUMON) !,BGPHD2 I BGPHD3]"" W:'$G(BGPSUMON) !,?1,BGPHD3
 S T=23 F X=1:1:8 S V=$P(BGPDAB(X),U) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"# w/ BMI calculated"
 S T=23 F X=1:1:8 S V=$P(BGPDAB(X),U,2) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% w/BMI calculated"
 S T=22 F X=1:1:8 S V=$P(BGPDAB(X),U,3) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# A. Overweight"
 S T=23 F X=1:1:8 S V=$P(BGPDAB(X),U,4) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% A. Overweight w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAB(X),U,5) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# B. Obese"
 S T=23 F X=1:1:8 S V=$P(BGPDAB(X),U,6) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% B. Obese w/",!," % of Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAB(X),U,7) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# C. Overweight",!," or Obese"
 S T=23 F X=1:1:8 S V=$P(BGPDAB(X),U,8) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% C. Overweight or Obese w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAB(X),U,9) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
 W:'$G(BGPSUMON) !!,"# D. w/refusal in",!," past yr"
 S T=23 F X=1:1:8 S V=$P(BGPDAB(X),U,10) W:'$G(BGPSUMON) ?T,$$C(V,0,6) S T=T+7
 W:'$G(BGPSUMON) !,"% D. w/refusal in past yr w/",!," % Total BMI"
 S T=22 F X=1:1:8 S V=$P(BGPDAB(X),U,11) W:'$G(BGPSUMON) ?T,$J(V,6,1) S T=T+7
BP ;
 ;percentage changes
 W:'$G(BGPSUMON) !!,"CHANGE FROM BASE YR %"
 W:'$G(BGPSUMON) !,"w/ BMI calculated"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,3),O=$P(BGPDAB(X),U,3) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"A. Overweight"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,5),O=$P(BGPDAB(X),U,5) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"B. Obese"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,7),O=$P(BGPDAB(X),U,7) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"C. Overweight",!," or Obese"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,9),O=$P(BGPDAB(X),U,9) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 W:'$G(BGPSUMON) !,"D. w/refusal in",!," past yr"
 S T=22 F X=1:1:8 S N=$P(BGPDAC(X),U,11),O=$P(BGPDAB(X),U,11) W:'$G(BGPSUMON) ?T,$J($FN((N-O),"+,",1),6) S T=T+7
 Q
SETN ;set numerator fields
 S BGPCYN=$$V^BGP9DP1C(1,BGPRPT,N,P)
 S BGPPRN=$$V^BGP9DP1C(2,BGPRPT,N,P)
 S BGPBLN=$$V^BGP9DP1C(3,BGPRPT,N,P)
 S BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
 S BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
 S BGPBLP=$S(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
 Q
V(T,R,N,P) ;EP
 I $G(BGPAREAA) G VA
 I T=1 Q $P($G(^BGPGPDCN(R,N)),U,P)
 I T=2 Q $P($G(^BGPGPDPN(R,N)),U,P)
 I T=3 Q $P($G(^BGPGPDBN(R,N)),U,P)
 Q ""
VA ;
 NEW X,V,C S X=0,C="" F  S X=$O(BGPSUL(X)) Q:X'=+X  D
 .I T=1 S C=C+$P($G(^BGPGPDCN(X,N)),U,P)
 .I T=2 S C=C+$P($G(^BGPGPDPN(X,N)),U,P)
 .I T=3 S C=C+$P($G(^BGPGPDBN(X,N)),U,P)
 .Q
 Q C
 ;
C(X,X2,X3) ;
 D COMMA^%DTC
 Q X
CTR(X,Y) ;EP - Center X in a field Y wide.
 Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
 ;----------
H3 ;EP
 Q:$G(BGPSUMON)
 W !!,$$CTR(BGPHD1,80)
 W !?40,"Age Distribution"
 W !?25,"2-5",?30,"6-11",?37,"12-19",?44,"20-24",?51,"25-34",?58,"35-44",?65,"45-54",?72,"55-74",!
 Q