BGP9ELLS ; IHS/CMI/LAB - print ind 01 Jul 2008 7:56 PM ;
;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
;
I1AGE ;EP
S BGPHD1="ACTIVE CLINICAL PTS 65+",BGPHD2="# Active Clinical Pts 65+"
S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB
S (C,D,E,F,G,H,I,J,K)=0 S BGPX="D",C=0 F BGPZZZ=1,2,3 D
.S BGPZ=BGPZZZ D I1AGE1
.S BGPP=4,BGPP1=5,BGPZ=BGPZZZ+3 D I1AGE2
.S BGPP=6,BGPP1=7,BGPZ=BGPZZZ+6 D I1AGE2
.S BGPP=8,BGPP1=9,BGPZ=BGPZZZ+9 D I1AGE2
.S BGPP=10,BGPP1=11,BGPZ=BGPZZZ+12 D I1AGE2
.S BGPP=12,BGPP1=13,BGPZ=BGPZZZ+15 D I1AGE2
.S BGPP=14,BGPP1=15,BGPZ=BGPZZZ+18 D I1AGE2
.S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
.S BGPP=18,BGPP1=19,BGPZ=BGPZZZ+24 D I1AGE2
.S BGPP=20,BGPP1=21,BGPZ=BGPZZZ+27 D I1AGE2
.S BGPP=22,BGPP1=23,BGPZ=BGPZZZ+30 D I1AGE2
.S BGPP=24,BGPP1=25,BGPZ=BGPZZZ+33 D I1AGE2
.S BGPP=26,BGPP1=27,BGPZ=BGPZZZ+36 D I1AGE2
.S BGPP=28,BGPP1=29,BGPZ=BGPZZZ+39 D I1AGE2
.S BGPP=30,BGPP1=31,BGPZ=BGPZZZ+42 D I1AGE2
.S BGPP=32,BGPP1=33,BGPZ=BGPZZZ+45 D I1AGE2
.S BGPP=34,BGPP1=35,BGPZ=BGPZZZ+48 D I1AGE2
.S BGPP=36,BGPP1=37,BGPZ=BGPZZZ+51 D I1AGE2
.S BGPP=38,BGPP1=39,BGPZ=BGPZZZ+54 D I1AGE2
.S BGPP=40,BGPP1=41,BGPZ=BGPZZZ+57 D I1AGE3
D I1AGEP
;MALE
S BGPHD1="MALE ACTIVE CLINICAL PTS 65+",BGPHD2="# Male Active Clinical Pts 65+"
S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB
S (C,D,E,F,G,H,I,J,K)=0 S BGPX="E",C=0 F BGPZZZ=1,2,3 D
.S BGPZ=BGPZZZ D I1AGE1
.S BGPP=4,BGPP1=5,BGPZ=BGPZZZ+3 D I1AGE2
.S BGPP=6,BGPP1=7,BGPZ=BGPZZZ+6 D I1AGE2
.S BGPP=8,BGPP1=9,BGPZ=BGPZZZ+9 D I1AGE2
.S BGPP=10,BGPP1=11,BGPZ=BGPZZZ+12 D I1AGE2
.S BGPP=12,BGPP1=13,BGPZ=BGPZZZ+15 D I1AGE2
.S BGPP=14,BGPP1=15,BGPZ=BGPZZZ+18 D I1AGE2
.S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
.S BGPP=18,BGPP1=19,BGPZ=BGPZZZ+24 D I1AGE2
.S BGPP=20,BGPP1=21,BGPZ=BGPZZZ+27 D I1AGE2
.S BGPP=22,BGPP1=23,BGPZ=BGPZZZ+30 D I1AGE2
.S BGPP=24,BGPP1=25,BGPZ=BGPZZZ+33 D I1AGE2
.S BGPP=26,BGPP1=27,BGPZ=BGPZZZ+36 D I1AGE2
.S BGPP=28,BGPP1=29,BGPZ=BGPZZZ+39 D I1AGE2
.S BGPP=30,BGPP1=31,BGPZ=BGPZZZ+42 D I1AGE2
.S BGPP=32,BGPP1=33,BGPZ=BGPZZZ+45 D I1AGE2
.S BGPP=34,BGPP1=35,BGPZ=BGPZZZ+48 D I1AGE2
.S BGPP=36,BGPP1=37,BGPZ=BGPZZZ+51 D I1AGE2
.S BGPP=38,BGPP1=39,BGPZ=BGPZZZ+54 D I1AGE2
.S BGPP=40,BGPP1=41,BGPZ=BGPZZZ+57 D I1AGE3
D I1AGEP
;FEMALE
S BGPHD1="FEMALE ACTIVE CLINICAL PTS 65+",BGPHD2="# Female Active Clinical Pts 65+"
S X=" " D S(X,1,1) D H3 S X=" " D S(X,1,1)
K BGPDAC,BGPDAP,BGPDAB
S (C,D,E,F,G,H,I,J,K)=0 S BGPX="F",C=0 F BGPZZZ=1,2,3 D
.S BGPZ=BGPZZZ D I1AGE1
.S BGPP=4,BGPP1=5,BGPZ=BGPZZZ+3 D I1AGE2
.S BGPP=6,BGPP1=7,BGPZ=BGPZZZ+6 D I1AGE2
.S BGPP=8,BGPP1=9,BGPZ=BGPZZZ+9 D I1AGE2
.S BGPP=10,BGPP1=11,BGPZ=BGPZZZ+12 D I1AGE2
.S BGPP=12,BGPP1=13,BGPZ=BGPZZZ+15 D I1AGE2
.S BGPP=14,BGPP1=15,BGPZ=BGPZZZ+18 D I1AGE2
.S BGPP=16,BGPP1=17,BGPZ=BGPZZZ+21 D I1AGE2
.S BGPP=18,BGPP1=19,BGPZ=BGPZZZ+24 D I1AGE2
.S BGPP=20,BGPP1=21,BGPZ=BGPZZZ+27 D I1AGE2
.S BGPP=22,BGPP1=23,BGPZ=BGPZZZ+30 D I1AGE2
.S BGPP=24,BGPP1=25,BGPZ=BGPZZZ+33 D I1AGE2
.S BGPP=26,BGPP1=27,BGPZ=BGPZZZ+36 D I1AGE2
.S BGPP=28,BGPP1=29,BGPZ=BGPZZZ+39 D I1AGE2
.S BGPP=30,BGPP1=31,BGPZ=BGPZZZ+42 D I1AGE2
.S BGPP=32,BGPP1=33,BGPZ=BGPZZZ+45 D I1AGE2
.S BGPP=34,BGPP1=35,BGPZ=BGPZZZ+48 D I1AGE2
.S BGPP=36,BGPP1=37,BGPZ=BGPZZZ+51 D I1AGE2
.S BGPP=38,BGPP1=39,BGPZ=BGPZZZ+54 D I1AGE2
.S BGPP=40,BGPP1=41,BGPZ=BGPZZZ+57 D I1AGE3
D I1AGEP
Q
I1AGE1 ;
S C=C+1
S BGPF="EDA."_BGPX_"."_BGPZ S BGPPC=$O(^BGPELIIN("C",BGPF,0))
S BGPDF=$P(^BGPELIIN(BGPPC,0),U,8)
S BGPNP=$P(^DD(90538.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U)=$$V(1,BGPRPT,N,P)
S $P(BGPDAP(C),U)=$$V(2,BGPRPT,N,P)
S $P(BGPDAB(C),U)=$$V(3,BGPRPT,N,P)
;
S BGPNF=$P(^BGPELIIN(BGPPC,0),U,9)
S BGPNP=$P(^DD(90538.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,2)=$$V(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(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(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="EDA."_BGPX_"."_BGPZ S BGPPC=$O(^BGPELIIN("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIN(BGPPC,0),U,9)
S BGPNP=$P(^DD(90538.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P),$P(BGPDAC(C),U,BGPP1)=$S($P(BGPDAC(C),U,2):($P(BGPDAC(C),U,BGPP)/$P(BGPDAC(C),U,2)*100),1:"")
S $P(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P),$P(BGPDAP(C),U,BGPP1)=$S($P(BGPDAP(C),U,2):($P(BGPDAP(C),U,BGPP)/$P(BGPDAP(C),U,2)*100),1:"")
S $P(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P),$P(BGPDAB(C),U,BGPP1)=$S($P(BGPDAB(C),U,2):($P(BGPDAB(C),U,BGPP)/$P(BGPDAB(C),U,2)*100),1:"")
Q
I1AGE3 ;
;S D=D+1
S BGPF="EDA."_BGPX_"."_BGPZ S BGPPC=$O(^BGPELIIN("C",BGPF,0))
;
S BGPNF=$P(^BGPELIIN(BGPPC,0),U,9)
S BGPNP=$P(^DD(90538.03,BGPNF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
S $P(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P),$P(BGPDAC(C),U,BGPP1)=$S($P(BGPDAC(C),U,1):($P(BGPDAC(C),U,BGPP)/$P(BGPDAC(C),U,1)*100),1:"")
S $P(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P),$P(BGPDAP(C),U,BGPP1)=$S($P(BGPDAP(C),U,1):($P(BGPDAP(C),U,BGPP)/$P(BGPDAP(C),U,1)*100),1:"")
S $P(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P),$P(BGPDAB(C),U,BGPP1)=$S($P(BGPDAB(C),U,1):($P(BGPDAB(C),U,BGPP)/$P(BGPDAB(C),U,1)*100),1:"")
Q
I1AGEP ;
S X=" " D S(X,1,1)
S X="CURRENT REPORT PERIOD" D S(X,1,1) S X=" " D S(X,1,1)
S X=BGPHD2 D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U) S Y=V D S(Y,,X+1)
S X="# w/exposure to at least 1 harmful drug" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,2) S Y=V D S(Y,,X+1)
S X="% w/exposure to at least 1 harmful drug" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,3) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="A. # w/antianxiety Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,4) S Y=V D S(Y,,X+1)
S X="% A. w/antianxiety Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,5) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="B. # w/antiemetic Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,6) S Y=V D S(Y,,X+1)
S X="% B. w/antiemetic Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,7) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="C. # w/analgesic Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,8) S Y=V D S(Y,,X+1)
S X="% C. w/analgesic Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,9) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="D. # w/antihistamine Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,10) S Y=V D S(Y,,X+1)
S X="% D. w/antihistamine Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,11) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="E. # w/antipsychotic Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,12) S Y=V D S(Y,,X+1)
S X="% E. w/antipsychotic Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,13) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="F. # w/amphetamine Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,14) S Y=V D S(Y,,X+1)
S X="% F. w/amphetamine Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,15) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="G. # w/barbiturate Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,16) S Y=V D S(Y,,X+1)
S X="% G. w/barbiturate Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,17) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="H. # w/benzodiazepine Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,18) S Y=V D S(Y,,X+1)
S X="% H. w/benzodiazepine Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,19) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="I. # w/other benzodiazepine Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,20) S Y=V D S(Y,,X+1)
S X="% I. w/other benzodiazepine Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,21) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="J. # w/calcium channel blocker Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,22) S Y=V D S(Y,,X+1)
S X="% J. w/calcium channel blocker Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,23) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="K. # w/gastro antispasmodic Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,24) S Y=V D S(Y,,X+1)
S X="% K. w/gastro antispasmodic Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,25) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="L. # w/belladonna alkaloid Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,26) S Y=V D S(Y,,X+1)
S X="% L. w/belladonna alkaloid Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,27) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="M. # w/skeletal muscle relaxant Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,28) S Y=V D S(Y,,X+1)
S X="% M. w/skeletal muscle relaxant Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,29) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="N. # w/oral estrogen Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,30) S Y=V D S(Y,,X+1)
S X="% N. w/oral estrogen Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,31) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="O. # w/oral hypoglycemic Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,32) S Y=V D S(Y,,X+1)
S X="% O. w/oral hypoglycemic Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,33) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="P. # w/narcotic Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,34) S Y=V D S(Y,,X+1)
S X="% P. w/narcotic Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,35) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="Q. # w/vasodilator Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,36) S Y=V D S(Y,,X+1)
S X="% Q. w/vasodilator Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,37) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="R. # w/other avoid meds Rx" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,38) S Y=V D S(Y,,X+1)
S X="% R. w/other avoid meds Rx w/ % of total meds" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,39) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
S X=" " D S(X,1,1) S X="# w/ exposure to multiple harmful drugs" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,40) S Y=V D S(Y,,X+1)
S X="% w/ exposure to multiple harmful drugs" D S(X,1,1)
F X=1:1:3 S V=$P(BGPDAC(X),U,41) S Y=$$SB^BGP9ELL2($J(V,6,1)) D S(Y,,X+1)
D I1AGEP^BGP9ELLT
Q
S(Y,F,P) ;set up array
I '$G(F) S F=0
S %=$P(^TMP($J,"BGPDEL",0),U)+F,$P(^TMP($J,"BGPDEL",0),U)=%
I '$D(^TMP($J,"BGPDEL",%)) S ^TMP($J,"BGPDEL",%)=""
S $P(^TMP($J,"BGPDEL",%),U,P)=Y
Q
CALC(N,O) ;
NEW Z
S Z=N-O,Z=$FN(Z,"+,",1)
Q Z
H3 ;EP
S X="Drugs to be Avoided in the Elderly" D S(X,1,1) S Y=" " D S(Y,1,1) S X=BGPHD1 D S(X,1,1) S Y=" " D S(Y,1,1)
S X="Age Distribution" D S(X,1,1) S X=" " D S(X,1,1)
S Y="65-74" D S(Y,1,2)
S Y="75-84" D S(Y,,3)
S Y=">84 yrs" D S(Y,,4)
Q
SB(X) ;EP
X ^DD("FUNC",$O(^DD("FUNC","B","STRIPBLANKS",0)),1)
Q X
H2 ;
S BGPX="",BGPX=BGPCYN
S $P(BGPX,U,2)=$$SB^BGP9ELL2($J(BGPCYP,5,1)),$P(BGPX,U,3)=BGPPRN,$P(BGPX,U,4)=$$SB^BGP9ELL2($J(BGPPRP,5,1)),$P(BGPX,U,5)=$$SB^BGP9ELL2($J($$CALC(BGPCYP,BGPPRP),6)),$P(BGPX,U,6)=BGPBLN,$P(BGPX,U,7)=$$SB^BGP9ELL2($J(BGPBLP,5,1))
S $P(BGPX,U,8)=$$SB^BGP9ELL2($J($$CALC(BGPCYP,BGPBLP),6))
D S(BGPX,,2)
Q
V(T,R,N,P) ;EP
I $G(BGPAREAA) G VA
NEW X
I T=1 S X=$P($G(^BGPELDCN(R,N)),U,P) Q $S(X]"":X,1:0)
I T=2 S X=$P($G(^BGPELDPN(R,N)),U,P) Q $S(X]"":X,1:0)
I T=3 S X=$P($G(^BGPELDBN(R,N)),U,P) Q $S(X]"":X,1:0)
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(^BGPELDCN(X,N)),U,P)
.I T=2 S C=C+$P($G(^BGPELDPN(X,N)),U,P)
.I T=3 S C=C+$P($G(^BGPELDBN(X,N)),U,P)
.Q
Q $S(C:C,1:0)
C(X,X2,X3) ;
NEW A,B,C,D,E,F,G,H,I,J,K
D COMMA^%DTC
Q X
BGP9ELLS ; IHS/CMI/LAB - print ind 01 Jul 2008 7:56 PM ;
+1 ;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
+2 ;
I1AGE ;EP
+1 SET BGPHD1="ACTIVE CLINICAL PTS 65+"
SET BGPHD2="# Active Clinical Pts 65+"
+2 SET X=" "
DO S(X,1,1)
DO H3
SET X=" "
DO S(X,1,1)
+3 KILL BGPDAC,BGPDAP,BGPDAB
+4 SET (C,D,E,F,G,H,I,J,K)=0
SET BGPX="D"
SET C=0
FOR BGPZZZ=1,2,3
Begin DoDot:1
+5 SET BGPZ=BGPZZZ
DO I1AGE1
+6 SET BGPP=4
SET BGPP1=5
SET BGPZ=BGPZZZ+3
DO I1AGE2
+7 SET BGPP=6
SET BGPP1=7
SET BGPZ=BGPZZZ+6
DO I1AGE2
+8 SET BGPP=8
SET BGPP1=9
SET BGPZ=BGPZZZ+9
DO I1AGE2
+9 SET BGPP=10
SET BGPP1=11
SET BGPZ=BGPZZZ+12
DO I1AGE2
+10 SET BGPP=12
SET BGPP1=13
SET BGPZ=BGPZZZ+15
DO I1AGE2
+11 SET BGPP=14
SET BGPP1=15
SET BGPZ=BGPZZZ+18
DO I1AGE2
+12 SET BGPP=16
SET BGPP1=17
SET BGPZ=BGPZZZ+21
DO I1AGE2
+13 SET BGPP=18
SET BGPP1=19
SET BGPZ=BGPZZZ+24
DO I1AGE2
+14 SET BGPP=20
SET BGPP1=21
SET BGPZ=BGPZZZ+27
DO I1AGE2
+15 SET BGPP=22
SET BGPP1=23
SET BGPZ=BGPZZZ+30
DO I1AGE2
+16 SET BGPP=24
SET BGPP1=25
SET BGPZ=BGPZZZ+33
DO I1AGE2
+17 SET BGPP=26
SET BGPP1=27
SET BGPZ=BGPZZZ+36
DO I1AGE2
+18 SET BGPP=28
SET BGPP1=29
SET BGPZ=BGPZZZ+39
DO I1AGE2
+19 SET BGPP=30
SET BGPP1=31
SET BGPZ=BGPZZZ+42
DO I1AGE2
+20 SET BGPP=32
SET BGPP1=33
SET BGPZ=BGPZZZ+45
DO I1AGE2
+21 SET BGPP=34
SET BGPP1=35
SET BGPZ=BGPZZZ+48
DO I1AGE2
+22 SET BGPP=36
SET BGPP1=37
SET BGPZ=BGPZZZ+51
DO I1AGE2
+23 SET BGPP=38
SET BGPP1=39
SET BGPZ=BGPZZZ+54
DO I1AGE2
+24 SET BGPP=40
SET BGPP1=41
SET BGPZ=BGPZZZ+57
DO I1AGE3
End DoDot:1
+25 DO I1AGEP
+26 ;MALE
+27 SET BGPHD1="MALE ACTIVE CLINICAL PTS 65+"
SET BGPHD2="# Male Active Clinical Pts 65+"
+28 SET X=" "
DO S(X,1,1)
DO H3
SET X=" "
DO S(X,1,1)
+29 KILL BGPDAC,BGPDAP,BGPDAB
+30 SET (C,D,E,F,G,H,I,J,K)=0
SET BGPX="E"
SET C=0
FOR BGPZZZ=1,2,3
Begin DoDot:1
+31 SET BGPZ=BGPZZZ
DO I1AGE1
+32 SET BGPP=4
SET BGPP1=5
SET BGPZ=BGPZZZ+3
DO I1AGE2
+33 SET BGPP=6
SET BGPP1=7
SET BGPZ=BGPZZZ+6
DO I1AGE2
+34 SET BGPP=8
SET BGPP1=9
SET BGPZ=BGPZZZ+9
DO I1AGE2
+35 SET BGPP=10
SET BGPP1=11
SET BGPZ=BGPZZZ+12
DO I1AGE2
+36 SET BGPP=12
SET BGPP1=13
SET BGPZ=BGPZZZ+15
DO I1AGE2
+37 SET BGPP=14
SET BGPP1=15
SET BGPZ=BGPZZZ+18
DO I1AGE2
+38 SET BGPP=16
SET BGPP1=17
SET BGPZ=BGPZZZ+21
DO I1AGE2
+39 SET BGPP=18
SET BGPP1=19
SET BGPZ=BGPZZZ+24
DO I1AGE2
+40 SET BGPP=20
SET BGPP1=21
SET BGPZ=BGPZZZ+27
DO I1AGE2
+41 SET BGPP=22
SET BGPP1=23
SET BGPZ=BGPZZZ+30
DO I1AGE2
+42 SET BGPP=24
SET BGPP1=25
SET BGPZ=BGPZZZ+33
DO I1AGE2
+43 SET BGPP=26
SET BGPP1=27
SET BGPZ=BGPZZZ+36
DO I1AGE2
+44 SET BGPP=28
SET BGPP1=29
SET BGPZ=BGPZZZ+39
DO I1AGE2
+45 SET BGPP=30
SET BGPP1=31
SET BGPZ=BGPZZZ+42
DO I1AGE2
+46 SET BGPP=32
SET BGPP1=33
SET BGPZ=BGPZZZ+45
DO I1AGE2
+47 SET BGPP=34
SET BGPP1=35
SET BGPZ=BGPZZZ+48
DO I1AGE2
+48 SET BGPP=36
SET BGPP1=37
SET BGPZ=BGPZZZ+51
DO I1AGE2
+49 SET BGPP=38
SET BGPP1=39
SET BGPZ=BGPZZZ+54
DO I1AGE2
+50 SET BGPP=40
SET BGPP1=41
SET BGPZ=BGPZZZ+57
DO I1AGE3
End DoDot:1
+51 DO I1AGEP
+52 ;FEMALE
+53 SET BGPHD1="FEMALE ACTIVE CLINICAL PTS 65+"
SET BGPHD2="# Female Active Clinical Pts 65+"
+54 SET X=" "
DO S(X,1,1)
DO H3
SET X=" "
DO S(X,1,1)
+55 KILL BGPDAC,BGPDAP,BGPDAB
+56 SET (C,D,E,F,G,H,I,J,K)=0
SET BGPX="F"
SET C=0
FOR BGPZZZ=1,2,3
Begin DoDot:1
+57 SET BGPZ=BGPZZZ
DO I1AGE1
+58 SET BGPP=4
SET BGPP1=5
SET BGPZ=BGPZZZ+3
DO I1AGE2
+59 SET BGPP=6
SET BGPP1=7
SET BGPZ=BGPZZZ+6
DO I1AGE2
+60 SET BGPP=8
SET BGPP1=9
SET BGPZ=BGPZZZ+9
DO I1AGE2
+61 SET BGPP=10
SET BGPP1=11
SET BGPZ=BGPZZZ+12
DO I1AGE2
+62 SET BGPP=12
SET BGPP1=13
SET BGPZ=BGPZZZ+15
DO I1AGE2
+63 SET BGPP=14
SET BGPP1=15
SET BGPZ=BGPZZZ+18
DO I1AGE2
+64 SET BGPP=16
SET BGPP1=17
SET BGPZ=BGPZZZ+21
DO I1AGE2
+65 SET BGPP=18
SET BGPP1=19
SET BGPZ=BGPZZZ+24
DO I1AGE2
+66 SET BGPP=20
SET BGPP1=21
SET BGPZ=BGPZZZ+27
DO I1AGE2
+67 SET BGPP=22
SET BGPP1=23
SET BGPZ=BGPZZZ+30
DO I1AGE2
+68 SET BGPP=24
SET BGPP1=25
SET BGPZ=BGPZZZ+33
DO I1AGE2
+69 SET BGPP=26
SET BGPP1=27
SET BGPZ=BGPZZZ+36
DO I1AGE2
+70 SET BGPP=28
SET BGPP1=29
SET BGPZ=BGPZZZ+39
DO I1AGE2
+71 SET BGPP=30
SET BGPP1=31
SET BGPZ=BGPZZZ+42
DO I1AGE2
+72 SET BGPP=32
SET BGPP1=33
SET BGPZ=BGPZZZ+45
DO I1AGE2
+73 SET BGPP=34
SET BGPP1=35
SET BGPZ=BGPZZZ+48
DO I1AGE2
+74 SET BGPP=36
SET BGPP1=37
SET BGPZ=BGPZZZ+51
DO I1AGE2
+75 SET BGPP=38
SET BGPP1=39
SET BGPZ=BGPZZZ+54
DO I1AGE2
+76 SET BGPP=40
SET BGPP1=41
SET BGPZ=BGPZZZ+57
DO I1AGE3
End DoDot:1
+77 DO I1AGEP
+78 QUIT
I1AGE1 ;
+1 SET C=C+1
+2 SET BGPF="EDA."_BGPX_"."_BGPZ
SET BGPPC=$ORDER(^BGPELIIN("C",BGPF,0))
+3 SET BGPDF=$PIECE(^BGPELIIN(BGPPC,0),U,8)
+4 SET BGPNP=$PIECE(^DD(90538.03,BGPDF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+5 SET $PIECE(BGPDAC(C),U)=$$V(1,BGPRPT,N,P)
+6 SET $PIECE(BGPDAP(C),U)=$$V(2,BGPRPT,N,P)
+7 SET $PIECE(BGPDAB(C),U)=$$V(3,BGPRPT,N,P)
+8 ;
+9 SET BGPNF=$PIECE(^BGPELIIN(BGPPC,0),U,9)
+10 SET BGPNP=$PIECE(^DD(90538.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+11 SET $PIECE(BGPDAC(C),U,2)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,3)=$SELECT($PIECE(BGPDAC(C),U,1):($PIECE(BGPDAC(C),U,2)/$PIECE(BGPDAC(C),U)*100),1:"")
+12 SET $PIECE(BGPDAP(C),U,2)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,3)=$SELECT($PIECE(BGPDAP(C),U,1):($PIECE(BGPDAP(C),U,2)/$PIECE(BGPDAP(C),U)*100),1:"")
+13 SET $PIECE(BGPDAB(C),U,2)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,3)=$SELECT($PIECE(BGPDAB(C),U,1):($PIECE(BGPDAB(C),U,2)/$PIECE(BGPDAB(C),U)*100),1:"")
+14 QUIT
I1AGE2 ;
+1 ;S D=D+1
+2 SET BGPF="EDA."_BGPX_"."_BGPZ
SET BGPPC=$ORDER(^BGPELIIN("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIN(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90538.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,BGPP1)=$SELECT($PIECE(BGPDAC(C),U,2):($PIECE(BGPDAC(C),U,BGPP)/$PIECE(BGPDAC(C),U,2)*100),1:"")
+7 SET $PIECE(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,BGPP1)=$SELECT($PIECE(BGPDAP(C),U,2):($PIECE(BGPDAP(C),U,BGPP)/$PIECE(BGPDAP(C),U,2)*100),1:"")
+8 SET $PIECE(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,BGPP1)=$SELECT($PIECE(BGPDAB(C),U,2):($PIECE(BGPDAB(C),U,BGPP)/$PIECE(BGPDAB(C),U,2)*100),1:"")
+9 QUIT
I1AGE3 ;
+1 ;S D=D+1
+2 SET BGPF="EDA."_BGPX_"."_BGPZ
SET BGPPC=$ORDER(^BGPELIIN("C",BGPF,0))
+3 ;
+4 SET BGPNF=$PIECE(^BGPELIIN(BGPPC,0),U,9)
+5 SET BGPNP=$PIECE(^DD(90538.03,BGPNF,0),U,4)
SET N=$PIECE(BGPNP,";")
SET P=$PIECE(BGPNP,";",2)
+6 SET $PIECE(BGPDAC(C),U,BGPP)=$$V(1,BGPRPT,N,P)
SET $PIECE(BGPDAC(C),U,BGPP1)=$SELECT($PIECE(BGPDAC(C),U,1):($PIECE(BGPDAC(C),U,BGPP)/$PIECE(BGPDAC(C),U,1)*100),1:"")
+7 SET $PIECE(BGPDAP(C),U,BGPP)=$$V(2,BGPRPT,N,P)
SET $PIECE(BGPDAP(C),U,BGPP1)=$SELECT($PIECE(BGPDAP(C),U,1):($PIECE(BGPDAP(C),U,BGPP)/$PIECE(BGPDAP(C),U,1)*100),1:"")
+8 SET $PIECE(BGPDAB(C),U,BGPP)=$$V(3,BGPRPT,N,P)
SET $PIECE(BGPDAB(C),U,BGPP1)=$SELECT($PIECE(BGPDAB(C),U,1):($PIECE(BGPDAB(C),U,BGPP)/$PIECE(BGPDAB(C),U,1)*100),1:"")
+9 QUIT
I1AGEP ;
+1 SET X=" "
DO S(X,1,1)
+2 SET X="CURRENT REPORT PERIOD"
DO S(X,1,1)
SET X=" "
DO S(X,1,1)
+3 SET X=BGPHD2
DO S(X,1,1)
+4 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U)
SET Y=V
DO S(Y,,X+1)
+5 SET X="# w/exposure to at least 1 harmful drug"
DO S(X,1,1)
+6 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,2)
SET Y=V
DO S(Y,,X+1)
+7 SET X="% w/exposure to at least 1 harmful drug"
DO S(X,1,1)
+8 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,3)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+9 SET X=" "
DO S(X,1,1)
SET X="A. # w/antianxiety Rx"
DO S(X,1,1)
+10 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,4)
SET Y=V
DO S(Y,,X+1)
+11 SET X="% A. w/antianxiety Rx w/ % of total meds"
DO S(X,1,1)
+12 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,5)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+13 SET X=" "
DO S(X,1,1)
SET X="B. # w/antiemetic Rx"
DO S(X,1,1)
+14 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,6)
SET Y=V
DO S(Y,,X+1)
+15 SET X="% B. w/antiemetic Rx w/ % of total meds"
DO S(X,1,1)
+16 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,7)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+17 SET X=" "
DO S(X,1,1)
SET X="C. # w/analgesic Rx"
DO S(X,1,1)
+18 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,8)
SET Y=V
DO S(Y,,X+1)
+19 SET X="% C. w/analgesic Rx w/ % of total meds"
DO S(X,1,1)
+20 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,9)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+21 SET X=" "
DO S(X,1,1)
SET X="D. # w/antihistamine Rx"
DO S(X,1,1)
+22 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,10)
SET Y=V
DO S(Y,,X+1)
+23 SET X="% D. w/antihistamine Rx w/ % of total meds"
DO S(X,1,1)
+24 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,11)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+25 SET X=" "
DO S(X,1,1)
SET X="E. # w/antipsychotic Rx"
DO S(X,1,1)
+26 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,12)
SET Y=V
DO S(Y,,X+1)
+27 SET X="% E. w/antipsychotic Rx w/ % of total meds"
DO S(X,1,1)
+28 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,13)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+29 SET X=" "
DO S(X,1,1)
SET X="F. # w/amphetamine Rx"
DO S(X,1,1)
+30 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,14)
SET Y=V
DO S(Y,,X+1)
+31 SET X="% F. w/amphetamine Rx w/ % of total meds"
DO S(X,1,1)
+32 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,15)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+33 SET X=" "
DO S(X,1,1)
SET X="G. # w/barbiturate Rx"
DO S(X,1,1)
+34 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,16)
SET Y=V
DO S(Y,,X+1)
+35 SET X="% G. w/barbiturate Rx w/ % of total meds"
DO S(X,1,1)
+36 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,17)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+37 SET X=" "
DO S(X,1,1)
SET X="H. # w/benzodiazepine Rx"
DO S(X,1,1)
+38 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,18)
SET Y=V
DO S(Y,,X+1)
+39 SET X="% H. w/benzodiazepine Rx w/ % of total meds"
DO S(X,1,1)
+40 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,19)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+41 SET X=" "
DO S(X,1,1)
SET X="I. # w/other benzodiazepine Rx"
DO S(X,1,1)
+42 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,20)
SET Y=V
DO S(Y,,X+1)
+43 SET X="% I. w/other benzodiazepine Rx w/ % of total meds"
DO S(X,1,1)
+44 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,21)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+45 SET X=" "
DO S(X,1,1)
SET X="J. # w/calcium channel blocker Rx"
DO S(X,1,1)
+46 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,22)
SET Y=V
DO S(Y,,X+1)
+47 SET X="% J. w/calcium channel blocker Rx w/ % of total meds"
DO S(X,1,1)
+48 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,23)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+49 SET X=" "
DO S(X,1,1)
SET X="K. # w/gastro antispasmodic Rx"
DO S(X,1,1)
+50 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,24)
SET Y=V
DO S(Y,,X+1)
+51 SET X="% K. w/gastro antispasmodic Rx w/ % of total meds"
DO S(X,1,1)
+52 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,25)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+53 SET X=" "
DO S(X,1,1)
SET X="L. # w/belladonna alkaloid Rx"
DO S(X,1,1)
+54 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,26)
SET Y=V
DO S(Y,,X+1)
+55 SET X="% L. w/belladonna alkaloid Rx w/ % of total meds"
DO S(X,1,1)
+56 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,27)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+57 SET X=" "
DO S(X,1,1)
SET X="M. # w/skeletal muscle relaxant Rx"
DO S(X,1,1)
+58 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,28)
SET Y=V
DO S(Y,,X+1)
+59 SET X="% M. w/skeletal muscle relaxant Rx w/ % of total meds"
DO S(X,1,1)
+60 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,29)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+61 SET X=" "
DO S(X,1,1)
SET X="N. # w/oral estrogen Rx"
DO S(X,1,1)
+62 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,30)
SET Y=V
DO S(Y,,X+1)
+63 SET X="% N. w/oral estrogen Rx w/ % of total meds"
DO S(X,1,1)
+64 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,31)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+65 SET X=" "
DO S(X,1,1)
SET X="O. # w/oral hypoglycemic Rx"
DO S(X,1,1)
+66 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,32)
SET Y=V
DO S(Y,,X+1)
+67 SET X="% O. w/oral hypoglycemic Rx w/ % of total meds"
DO S(X,1,1)
+68 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,33)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+69 SET X=" "
DO S(X,1,1)
SET X="P. # w/narcotic Rx"
DO S(X,1,1)
+70 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,34)
SET Y=V
DO S(Y,,X+1)
+71 SET X="% P. w/narcotic Rx w/ % of total meds"
DO S(X,1,1)
+72 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,35)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+73 SET X=" "
DO S(X,1,1)
SET X="Q. # w/vasodilator Rx"
DO S(X,1,1)
+74 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,36)
SET Y=V
DO S(Y,,X+1)
+75 SET X="% Q. w/vasodilator Rx w/ % of total meds"
DO S(X,1,1)
+76 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,37)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+77 SET X=" "
DO S(X,1,1)
SET X="R. # w/other avoid meds Rx"
DO S(X,1,1)
+78 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,38)
SET Y=V
DO S(Y,,X+1)
+79 SET X="% R. w/other avoid meds Rx w/ % of total meds"
DO S(X,1,1)
+80 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,39)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+81 SET X=" "
DO S(X,1,1)
SET X="# w/ exposure to multiple harmful drugs"
DO S(X,1,1)
+82 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,40)
SET Y=V
DO S(Y,,X+1)
+83 SET X="% w/ exposure to multiple harmful drugs"
DO S(X,1,1)
+84 FOR X=1:1:3
SET V=$PIECE(BGPDAC(X),U,41)
SET Y=$$SB^BGP9ELL2($JUSTIFY(V,6,1))
DO S(Y,,X+1)
+85 DO I1AGEP^BGP9ELLT
+86 QUIT
S(Y,F,P) ;set up array
+1 IF '$GET(F)
SET F=0
+2 SET %=$PIECE(^TMP($JOB,"BGPDEL",0),U)+F
SET $PIECE(^TMP($JOB,"BGPDEL",0),U)=%
+3 IF '$DATA(^TMP($JOB,"BGPDEL",%))
SET ^TMP($JOB,"BGPDEL",%)=""
+4 SET $PIECE(^TMP($JOB,"BGPDEL",%),U,P)=Y
+5 QUIT
CALC(N,O) ;
+1 NEW Z
+2 SET Z=N-O
SET Z=$FNUMBER(Z,"+,",1)
+3 QUIT Z
H3 ;EP
+1 SET X="Drugs to be Avoided in the Elderly"
DO S(X,1,1)
SET Y=" "
DO S(Y,1,1)
SET X=BGPHD1
DO S(X,1,1)
SET Y=" "
DO S(Y,1,1)
+2 SET X="Age Distribution"
DO S(X,1,1)
SET X=" "
DO S(X,1,1)
+3 SET Y="65-74"
DO S(Y,1,2)
+4 SET Y="75-84"
DO S(Y,,3)
+5 SET Y=">84 yrs"
DO S(Y,,4)
+6 QUIT
SB(X) ;EP
+1 XECUTE ^DD("FUNC",$ORDER(^DD("FUNC","B","STRIPBLANKS",0)),1)
+2 QUIT X
H2 ;
+1 SET BGPX=""
SET BGPX=BGPCYN
+2 SET $PIECE(BGPX,U,2)=$$SB^BGP9ELL2($JUSTIFY(BGPCYP,5,1))
SET $PIECE(BGPX,U,3)=BGPPRN
SET $PIECE(BGPX,U,4)=$$SB^BGP9ELL2($JUSTIFY(BGPPRP,5,1))
SET $PIECE(BGPX,U,5)=$$SB^BGP9ELL2($JUSTIFY($$CALC(BGPCYP,BGPPRP),6))
SET $PIECE(BGPX,U,6)=BGPBLN
SET $PIECE(BGPX,U,7)=$$SB^BGP9ELL2($JUSTIFY(BGPBLP,5,1))
+3 SET $PIECE(BGPX,U,8)=$$SB^BGP9ELL2($JUSTIFY($$CALC(BGPCYP,BGPBLP),6))
+4 DO S(BGPX,,2)
+5 QUIT
V(T,R,N,P) ;EP
+1 IF $GET(BGPAREAA)
GOTO VA
+2 NEW X
+3 IF T=1
SET X=$PIECE($GET(^BGPELDCN(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+4 IF T=2
SET X=$PIECE($GET(^BGPELDPN(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+5 IF T=3
SET X=$PIECE($GET(^BGPELDBN(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+6 QUIT ""
VA ;
+1 NEW X,V,C
SET X=0
SET C=""
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+2 IF T=1
SET C=C+$PIECE($GET(^BGPELDCN(X,N)),U,P)
+3 IF T=2
SET C=C+$PIECE($GET(^BGPELDPN(X,N)),U,P)
+4 IF T=3
SET C=C+$PIECE($GET(^BGPELDBN(X,N)),U,P)
+5 QUIT
End DoDot:1
+6 QUIT $SELECT(C:C,1:0)
C(X,X2,X3) ;
+1 NEW A,B,C,D,E,F,G,H,I,J,K
+2 DO COMMA^%DTC
+3 QUIT X