BGPDP1B ; IHS/CMI/LAB - print ind 1B ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
;
I1B ;EP ; diabetes prevalence
;Q:'$D(BGPIND(2))
D HEADER^BGPDPH
W !,"Indicator 1B: Diabetes Prevalence using patients seen w/DM in the year",!,"prior to the end of the time period."
W !,"Continue tracking area age specific diabetes prevalence rates to identify"
W !,"trends in the age specific prevalence of diabetes (as a surrogate marker for"
W !,"diabetes incidence) for the AI/AN population.",!
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT
W !,"Prevalence of Diabetes (w/DM DX in year prior to end of time period)",!
D H1^BGPDPH
S BGPCYD=$P($$V(BGPRPT,10,1),"!",1)+$P($$V(BGPRPT,10,1),"!",2),BGPCYN=$P($$V(BGPRPT,11,1),"!",1)+$P($$V(BGPRPT,11,1),"!",2),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98D=$P($$V(BGPRPT,80,1),"!",1)+$P($$V(BGPRPT,80,1),"!",2),BGP98N=$P($$V(BGPRPT,81,1),"!",1)+$P($$V(BGPRPT,81,1),"!",2),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRD=$P($$V(BGPRPT,40,1),"!",1)+$P($$V(BGPRPT,40,1),"!",2),BGPPRN=$P($$V(BGPRPT,41,1),"!",1)+$P($$V(BGPRPT,41,1),"!",2),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
W !,"# active users",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
W !,"# w/ DM DX w/in",!,"year"
D H2^BGPDPH
I1BF ;
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT D H1^BGPDPH
S BGPCYD=$P($$V(BGPRPT,10,1),"!",2),BGPCYN=$P($$V(BGPRPT,11,1),"!",2),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98D=$P($$V(BGPRPT,80,1),"!",2),BGP98N=$P($$V(BGPRPT,81,1),"!",2),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRD=$P($$V(BGPRPT,40,1),"!",2),BGPPRN=$P($$V(BGPRPT,41,1),"!",2),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
W !!!,"# FEMALE active users",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
W !,"# w/ DM DX w/in",!,"year"
D H2^BGPDPH
I1BM ;
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT D H1^BGPDPH
S BGPCYD=$P($$V(BGPRPT,10,1),"!",1),BGPCYN=$P($$V(BGPRPT,11,1),"!",1),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98D=$P($$V(BGPRPT,80,1),"!",1),BGP98N=$P($$V(BGPRPT,81,1),"!",1),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRD=$P($$V(BGPRPT,40,1),"!",1),BGPPRN=$P($$V(BGPRPT,41,1),"!",1),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
W !!!,"# MALE active users",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
W !,"# w/ DM DX w/in",!,"year"
D H2^BGPDPH
I1BA ;
S BGPHD1="TOTAL ACTIVE USERS"
D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !,"CURRENT REPORTING PERIOD"
W !,"Total # active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,10,X) S V=$P(Y,"!")+$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,11,X),V=$P(Y,"!")+$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
K BGPX
S BGPDNODE=10,BGPNNODE=11 D CHG1
I $Y>(IOSL-8) D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !!,"PREVIOUS YEAR PERIOD"
W !,"Total # active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,40,X) S V=$P(Y,"!")+$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,41,X),V=$P(Y,"!")+$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
S BGPDNODE=40,BGPNNODE=41 D CHG1
I $Y>(IOSL-8) D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !!,"BASELINE REPORTING PERIOD"
W !,"Total # active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,80,X) S V=$P(Y,"!")+$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,81,X),V=$P(Y,"!")+$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
S BGPDNODE=80,BGPNNODE=81 D CHG1
D CHG
I1BAF ;
S BGPHD1="FEMALE ACTIVE USERS"
D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !,"CURRENT REPORTING PERIOD"
W !,"# FEMALE active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,10,X) S V=$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,11,X),V=$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
K BGPX W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,11,X),D=$$V(BGPRPT,10,X),N1=$P(N,"!",2),D1=$P(D,"!",2),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 S $P(BGPX(X),U)=%
I $Y>(IOSL-8) D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !!,"PREVIOUS YEAR PERIOD"
W !,"# FEMALE active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,40,X) S V=$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,41,X),V=$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,41,X),D=$$V(BGPRPT,40,X),N1=$P(N,"!",2),D1=$P(D,"!",2),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 S $P(BGPX(X),U,3)=%
I $Y>(IOSL-8) D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !!,"BASELINE REPORTING PERIOD"
W !,"# FEMALE active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,80,X) S V=$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,81,X),V=$P(Y,"!",2) W ?T,$$C(V,0,6) S T=T+7
W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,81,X),D=$$V(BGPRPT,80,X),N1=$P(N,"!",2),D1=$P(D,"!",2),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 S $P(BGPX(X),U,2)=%
D CHG
I1BAM ;
S BGPHD1="MALE ACTIVE USERS"
D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !,"CURRENT REPORTING PERIOD"
W !,"# MALE active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,10,X) S V=$P(Y,"!",1) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,11,X),V=$P(Y,"!",1) W ?T,$$C(V,0,6) S T=T+7
K BGPX W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,11,X),D=$$V(BGPRPT,10,X),N1=$P(N,"!",1),D1=$P(D,"!",1),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 S $P(BGPX(X),U)=%
I $Y>(IOSL-8) D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !!,"PREVIOUS YEAR PERIOD"
W !,"# MALE active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,40,X) S V=$P(Y,"!",1) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,41,X),V=$P(Y,"!",1) W ?T,$$C(V,0,6) S T=T+7
W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,41,X),D=$$V(BGPRPT,40,X),N1=$P(N,"!",1),D1=$P(D,"!",1),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 S $P(BGPX(X),U,3)=%
I $Y>(IOSL-8) D HEADER^BGPDPH Q:BGPQUIT D H4^BGPDPH
W !!,"BASELINE REPORTING PERIOD"
W !,"# MALE active users"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,80,X) S V=$P(Y,"!",1) W ?T,$$C(V,0,6) S T=T+7
W !,"# w/Diabetes DX in yr"
S T=23 F X=2:1:9 S Y=$$V(BGPRPT,81,X),V=$P(Y,"!",1) W ?T,$$C(V,0,6) S T=T+7
W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,81,X),D=$$V(BGPRPT,80,X),N1=$P(N,"!",1),D1=$P(D,"!",1),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 S $P(BGPX(X),U,2)=%
D CHG
Q
CHG1 ;
W !,"% with DM DX in yr" S T=23 F X=2:1:9 S N=$$V(BGPRPT,BGPNNODE,X),D=$$V(BGPRPT,BGPDNODE,X),N1=$P(N,"!")+$P(N,"!",2),D1=$P(D,"!")+$P(D,"!",2),%=$S('D1:"",1:(N1/D1)*100) W ?T,$S(%="":" .",1:$J(%,5,1)) S T=T+7 D
.S A=$S(BGPDNODE=10:1,BGPDNODE=40:3,BGPDNODE=80:2,1:"") S $P(BGPX(X),U,A)=%
Q
CHG ;
S T=23 W !!,"% Change from prev yr" S X=0 F S X=$O(BGPX(X)) Q:X'=+X S N=$P(BGPX(X),U),O=$P(BGPX(X),U,3) W ?T,$J($$CALC(N,O),6) S T=T+7
S T=23 W !!,"% Change from base yr" S X=0 F S X=$O(BGPX(X)) Q:X'=+X S N=$P(BGPX(X),U),O=$P(BGPX(X),U,2) W ?T,$J($$CALC(N,O),6) S T=T+7
Q
CALC(N,O) ;ENTRY POINT
NEW Z
I O=0!(N=0)!(O="")!(N="") Q "**"
NEW X,X2,X3
S X=N,X2=1,X3=0 D COMMA^%DTC S N=X
S X=O,X2=1,X3=0 D COMMA^%DTC S O=X
I +O=0 Q "**"
S Z=(((N-O)/O)*100),Z=$FN(Z,"+,",1)
Q Z
V(R,N,P) ;
NEW Y
I $G(BGPAREAA),'$G(BGPSUMR) G VA
Q $P($G(^BGPD(R,N)),U,P)
VA ;
NEW X,C,V,MT,FT,M,F,B S X=0,C="" F S X=$O(BGPSUL(X)) Q:X'=+X D
.S V=$P($G(^BGPD(X,N)),U,P)
.I C="" S C=V Q
.S MT=$P(C,"!"),FT=$P(C,"!",2),M=$P(V,"!"),F=$P(V,"!",2)
.F B=1:1:6 S $P(MT,"~",B)=$P(MT,"~",B)+$P(M,"~",B)
.F B=1:1:6 S $P(FT,"~",B)=$P(FT,"~",B)+$P(F,"~",B)
.S C=MT_"!"_FT
.Q
Q C
C(X,X2,X3) ;
D COMMA^%DTC
Q X
BGPDP1B ; IHS/CMI/LAB - print ind 1B ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+2 ;
+3 ;
I1B ;EP ; diabetes prevalence
+1 ;Q:'$D(BGPIND(2))
+2 DO HEADER^BGPDPH
+3 WRITE !,"Indicator 1B: Diabetes Prevalence using patients seen w/DM in the year",!,"prior to the end of the time period."
+4 WRITE !,"Continue tracking area age specific diabetes prevalence rates to identify"
+5 WRITE !,"trends in the age specific prevalence of diabetes (as a surrogate marker for"
+6 WRITE !,"diabetes incidence) for the AI/AN population.",!
+7 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
+8 WRITE !,"Prevalence of Diabetes (w/DM DX in year prior to end of time period)",!
+9 DO H1^BGPDPH
+10 SET BGPCYD=$PIECE($$V(BGPRPT,10,1),"!",1)+$PIECE($$V(BGPRPT,10,1),"!",2)
SET BGPCYN=$PIECE($$V(BGPRPT,11,1),"!",1)+$PIECE($$V(BGPRPT,11,1),"!",2)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+11 SET BGP98D=$PIECE($$V(BGPRPT,80,1),"!",1)+$PIECE($$V(BGPRPT,80,1),"!",2)
SET BGP98N=$PIECE($$V(BGPRPT,81,1),"!",1)+$PIECE($$V(BGPRPT,81,1),"!",2)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+12 SET BGPPRD=$PIECE($$V(BGPRPT,40,1),"!",1)+$PIECE($$V(BGPRPT,40,1),"!",2)
SET BGPPRN=$PIECE($$V(BGPRPT,41,1),"!",1)+$PIECE($$V(BGPRPT,41,1),"!",2)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+13 WRITE !,"# active users",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
+14 WRITE !,"# w/ DM DX w/in",!,"year"
+15 DO H2^BGPDPH
I1BF ;
+1 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H1^BGPDPH
+2 SET BGPCYD=$PIECE($$V(BGPRPT,10,1),"!",2)
SET BGPCYN=$PIECE($$V(BGPRPT,11,1),"!",2)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+3 SET BGP98D=$PIECE($$V(BGPRPT,80,1),"!",2)
SET BGP98N=$PIECE($$V(BGPRPT,81,1),"!",2)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+4 SET BGPPRD=$PIECE($$V(BGPRPT,40,1),"!",2)
SET BGPPRN=$PIECE($$V(BGPRPT,41,1),"!",2)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+5 WRITE !!!,"# FEMALE active users",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
+6 WRITE !,"# w/ DM DX w/in",!,"year"
+7 DO H2^BGPDPH
I1BM ;
+1 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H1^BGPDPH
+2 SET BGPCYD=$PIECE($$V(BGPRPT,10,1),"!",1)
SET BGPCYN=$PIECE($$V(BGPRPT,11,1),"!",1)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+3 SET BGP98D=$PIECE($$V(BGPRPT,80,1),"!",1)
SET BGP98N=$PIECE($$V(BGPRPT,81,1),"!",1)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+4 SET BGPPRD=$PIECE($$V(BGPRPT,40,1),"!",1)
SET BGPPRN=$PIECE($$V(BGPRPT,41,1),"!",1)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+5 WRITE !!!,"# MALE active users",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
+6 WRITE !,"# w/ DM DX w/in",!,"year"
+7 DO H2^BGPDPH
I1BA ;
+1 SET BGPHD1="TOTAL ACTIVE USERS"
+2 DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+3 WRITE !,"CURRENT REPORTING PERIOD"
+4 WRITE !,"Total # active users"
+5 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,10,X)
SET V=$PIECE(Y,"!")+$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+6 WRITE !,"# w/Diabetes DX in yr"
+7 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,11,X)
SET V=$PIECE(Y,"!")+$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+8 KILL BGPX
+9 SET BGPDNODE=10
SET BGPNNODE=11
DO CHG1
+10 IF $Y>(IOSL-8)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+11 WRITE !!,"PREVIOUS YEAR PERIOD"
+12 WRITE !,"Total # active users"
+13 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,40,X)
SET V=$PIECE(Y,"!")+$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+14 WRITE !,"# w/Diabetes DX in yr"
+15 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,41,X)
SET V=$PIECE(Y,"!")+$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+16 SET BGPDNODE=40
SET BGPNNODE=41
DO CHG1
+17 IF $Y>(IOSL-8)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+18 WRITE !!,"BASELINE REPORTING PERIOD"
+19 WRITE !,"Total # active users"
+20 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,80,X)
SET V=$PIECE(Y,"!")+$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+21 WRITE !,"# w/Diabetes DX in yr"
+22 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,81,X)
SET V=$PIECE(Y,"!")+$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+23 SET BGPDNODE=80
SET BGPNNODE=81
DO CHG1
+24 DO CHG
I1BAF ;
+1 SET BGPHD1="FEMALE ACTIVE USERS"
+2 DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+3 WRITE !,"CURRENT REPORTING PERIOD"
+4 WRITE !,"# FEMALE active users"
+5 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,10,X)
SET V=$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+6 WRITE !,"# w/Diabetes DX in yr"
+7 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,11,X)
SET V=$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+8 KILL BGPX
WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,11,X)
SET D=$$V(BGPRPT,10,X)
SET N1=$PIECE(N,"!",2)
SET D1=$PIECE(D,"!",2)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
SET $PIECE(BGPX(X),U)=%
+9 IF $Y>(IOSL-8)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+10 WRITE !!,"PREVIOUS YEAR PERIOD"
+11 WRITE !,"# FEMALE active users"
+12 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,40,X)
SET V=$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+13 WRITE !,"# w/Diabetes DX in yr"
+14 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,41,X)
SET V=$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+15 WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,41,X)
SET D=$$V(BGPRPT,40,X)
SET N1=$PIECE(N,"!",2)
SET D1=$PIECE(D,"!",2)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
SET $PIECE(BGPX(X),U,3)=%
+16 IF $Y>(IOSL-8)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+17 WRITE !!,"BASELINE REPORTING PERIOD"
+18 WRITE !,"# FEMALE active users"
+19 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,80,X)
SET V=$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+20 WRITE !,"# w/Diabetes DX in yr"
+21 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,81,X)
SET V=$PIECE(Y,"!",2)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+22 WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,81,X)
SET D=$$V(BGPRPT,80,X)
SET N1=$PIECE(N,"!",2)
SET D1=$PIECE(D,"!",2)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
SET $PIECE(BGPX(X),U,2)=%
+23 DO CHG
I1BAM ;
+1 SET BGPHD1="MALE ACTIVE USERS"
+2 DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+3 WRITE !,"CURRENT REPORTING PERIOD"
+4 WRITE !,"# MALE active users"
+5 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,10,X)
SET V=$PIECE(Y,"!",1)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+6 WRITE !,"# w/Diabetes DX in yr"
+7 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,11,X)
SET V=$PIECE(Y,"!",1)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+8 KILL BGPX
WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,11,X)
SET D=$$V(BGPRPT,10,X)
SET N1=$PIECE(N,"!",1)
SET D1=$PIECE(D,"!",1)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
SET $PIECE(BGPX(X),U)=%
+9 IF $Y>(IOSL-8)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+10 WRITE !!,"PREVIOUS YEAR PERIOD"
+11 WRITE !,"# MALE active users"
+12 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,40,X)
SET V=$PIECE(Y,"!",1)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+13 WRITE !,"# w/Diabetes DX in yr"
+14 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,41,X)
SET V=$PIECE(Y,"!",1)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+15 WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,41,X)
SET D=$$V(BGPRPT,40,X)
SET N1=$PIECE(N,"!",1)
SET D1=$PIECE(D,"!",1)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
SET $PIECE(BGPX(X),U,3)=%
+16 IF $Y>(IOSL-8)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
DO H4^BGPDPH
+17 WRITE !!,"BASELINE REPORTING PERIOD"
+18 WRITE !,"# MALE active users"
+19 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,80,X)
SET V=$PIECE(Y,"!",1)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+20 WRITE !,"# w/Diabetes DX in yr"
+21 SET T=23
FOR X=2:1:9
SET Y=$$V(BGPRPT,81,X)
SET V=$PIECE(Y,"!",1)
WRITE ?T,$$C(V,0,6)
SET T=T+7
+22 WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,81,X)
SET D=$$V(BGPRPT,80,X)
SET N1=$PIECE(N,"!",1)
SET D1=$PIECE(D,"!",1)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
SET $PIECE(BGPX(X),U,2)=%
+23 DO CHG
+24 QUIT
CHG1 ;
+1 WRITE !,"% with DM DX in yr"
SET T=23
FOR X=2:1:9
SET N=$$V(BGPRPT,BGPNNODE,X)
SET D=$$V(BGPRPT,BGPDNODE,X)
SET N1=$PIECE(N,"!")+$PIECE(N,"!",2)
SET D1=$PIECE(D,"!")+$PIECE(D,"!",2)
SET %=$SELECT('D1:"",1:(N1/D1)*100)
WRITE ?T,$SELECT(%="":" .",1:$JUSTIFY(%,5,1))
SET T=T+7
Begin DoDot:1
+2 SET A=$SELECT(BGPDNODE=10:1,BGPDNODE=40:3,BGPDNODE=80:2,1:"")
SET $PIECE(BGPX(X),U,A)=%
End DoDot:1
+3 QUIT
CHG ;
+1 SET T=23
WRITE !!,"% Change from prev yr"
SET X=0
FOR
SET X=$ORDER(BGPX(X))
IF X'=+X
QUIT
SET N=$PIECE(BGPX(X),U)
SET O=$PIECE(BGPX(X),U,3)
WRITE ?T,$JUSTIFY($$CALC(N,O),6)
SET T=T+7
+2 SET T=23
WRITE !!,"% Change from base yr"
SET X=0
FOR
SET X=$ORDER(BGPX(X))
IF X'=+X
QUIT
SET N=$PIECE(BGPX(X),U)
SET O=$PIECE(BGPX(X),U,2)
WRITE ?T,$JUSTIFY($$CALC(N,O),6)
SET T=T+7
+3 QUIT
CALC(N,O) ;ENTRY POINT
+1 NEW Z
+2 IF O=0!(N=0)!(O="")!(N="")
QUIT "**"
+3 NEW X,X2,X3
+4 SET X=N
SET X2=1
SET X3=0
DO COMMA^%DTC
SET N=X
+5 SET X=O
SET X2=1
SET X3=0
DO COMMA^%DTC
SET O=X
+6 IF +O=0
QUIT "**"
+7 SET Z=(((N-O)/O)*100)
SET Z=$FNUMBER(Z,"+,",1)
+8 QUIT Z
V(R,N,P) ;
+1 NEW Y
+2 IF $GET(BGPAREAA)
IF '$GET(BGPSUMR)
GOTO VA
+3 QUIT $PIECE($GET(^BGPD(R,N)),U,P)
VA ;
+1 NEW X,C,V,MT,FT,M,F,B
SET X=0
SET C=""
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+2 SET V=$PIECE($GET(^BGPD(X,N)),U,P)
+3 IF C=""
SET C=V
QUIT
+4 SET MT=$PIECE(C,"!")
SET FT=$PIECE(C,"!",2)
SET M=$PIECE(V,"!")
SET F=$PIECE(V,"!",2)
+5 FOR B=1:1:6
SET $PIECE(MT,"~",B)=$PIECE(MT,"~",B)+$PIECE(M,"~",B)
+6 FOR B=1:1:6
SET $PIECE(FT,"~",B)=$PIECE(FT,"~",B)+$PIECE(F,"~",B)
+7 SET C=MT_"!"_FT
+8 QUIT
End DoDot:1
+9 QUIT C
C(X,X2,X3) ;
+1 DO COMMA^%DTC
+2 QUIT X