[613] | 1 | ONCOSSA3 ;WASH ISC/SRR-Print life tables ;11/1/93 12:34
|
---|
| 2 | ;;2.11;ONCOLOGY;**13**;Mar 07, 1995
|
---|
| 3 | ;
|
---|
| 4 | PRINT ;print actuarial life tables
|
---|
| 5 | ;in: CASES,LEN,GRP,HEADER,INTS,NGRPS,NPG,XCRT,^TMP($J
|
---|
| 6 | ;out: NPG
|
---|
| 7 | N INT,LEFT,LOSSES,MORTS,PSURV
|
---|
| 8 | S ONCOEX=0 F GRP=1:1:NGRPS Q:ONCOEX D:CASES(GRP) PRLT
|
---|
| 9 | Q
|
---|
| 10 | ;
|
---|
| 11 | PRLT ;print life table
|
---|
| 12 | S (MORTS,LOSSES)=0,LEFT=CASES(GRP),PSURV=100,INTS=INTS(GRP)
|
---|
| 13 | I ($Y+INTS+2<IOSL)&(NPG>0) D WGRP
|
---|
| 14 | E D WHEAD Q:ONCOEX
|
---|
| 15 | F INT=0:1:INTS Q:ONCOEX D WINT,WHEAD:INT<INTS&($Y=IOSL)
|
---|
| 16 | Q
|
---|
| 17 | ;
|
---|
| 18 | WHEAD ;write header
|
---|
| 19 | D TOF Q:ONCOEX W $P(HEADER,U,1),"Life Table",?IOM-30,$P(HEADER,U,2),NPG,!
|
---|
| 20 | W " ",$P(LEN,U,3),?11,"% Alive",?21,"# Left",?31,"Deaths",?41,"Losses",!
|
---|
| 21 | F X=1:1:IOM W "-"
|
---|
| 22 | WGRP W ! W:NGRPS>1 "Group ",$C(GRP+64),": ",^TMP($J,"GRP",GRP),!
|
---|
| 23 | Q
|
---|
| 24 | ;
|
---|
| 25 | TOF ;write top of form & bump page
|
---|
| 26 | I XCRT,NPG,'$G(ONCOEX) W *7 R !,"Enter RETURN to continue or '^' to exit: ",X:DTIME S ONCOEX=$S('$T:1,X="^":1,1:0)
|
---|
| 27 | I '$G(ONCOEX) W:$Y @IOF S NPG=NPG+1
|
---|
| 28 | Q
|
---|
| 29 | ;
|
---|
| 30 | WINT ;write (& compute) an interval
|
---|
| 31 | S LOSSES=+$G(^TMP($J,"LT",GRP,INT,0)),MORTS=+$G(^(1))
|
---|
| 32 | W $J(INT,5),?12,$J(PSURV,5,1),?22,$J(LEFT,5),?32,$J(MORTS,5)
|
---|
| 33 | W ?42,$J(LOSSES,5),!
|
---|
| 34 | S PSURV=$S(MORTS=0:PSURV,LEFT=0:0,1:PSURV*(1-(MORTS/(LEFT-(LOSSES/2)))))
|
---|
| 35 | S LEFT=LEFT-MORTS-LOSSES
|
---|
| 36 | Q
|
---|