source: FOIAVistA/trunk/r/ONCOLOGY-ONC/ONCOSSA4.m@ 1607

Last change on this file since 1607 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.7 KB
Line 
1ONCOSSA4 ;WASH ISC/SRR,MLH-PLOT SURVIVAL SURVES ;11/1/93 12:33
2 ;;2.11;ONCOLOGY;;Mar 07, 1995
3PLOT ;plot survival curves
4 ;in: CASES,HEADER,LEN,NGRPS,NMORT,NPG,XCRT,^TMP($J
5 ;use: GRP
6 ;out: NPG
7 ;do: TOF^ONCOSSA3
8 D TOF^ONCOSSA3 Q:ONCOEX W $P(HEADER,U,1),"Survival Curve",$S(NGRPS>1:"s",1:"")
9 W ?IOM-30,$P(HEADER,U,2),NPG I NMORT=0 W !!,"NO deaths!",! Q
10 N IX,LMORT,LN,N,NLN,NX,P,XADJ,XSCL,XSIZ,YSIZ
11 I IOM<120 S NLN=20,XSIZ=60
12 E S NLN=50,XSIZ=120
13 S XSCL=0,YSIZ=100/NLN,LMORT=""
14 F GRP=1:1:NGRPS S N=CASES(GRP) D:N CPLT
15 S X="1;.01^3;.025^6;.05^12;.1^30;.25^60;.5^120;1",XSCL=XSCL/LEN
16 I XSCL>120 S XSCL=XSCL-1/120+1\1
17 E F GRP=1:1:99 S Y=$P(X,U,GRP) Q:Y="" I XSCL'>+Y S XSCL=$P(Y,";",2) Q
18 S:XSIZ=60 XSCL=XSCL+XSCL S XADJ=XSCL*LEN
19 F GRP=1:1:NGRPS S:$D(INS(GRP)) INTS(GRP)=INTS(GRP)\XADJ
20 F LN=0:1:NLN-1 D PLIN
21 W !?7,"0 |" F X=1:1:XSIZ W $S(X#10=0:"+",1:"-")
22 W !," ",$P(LEN,U,3),":",?8 S Y=$S(XSCL<.1:2,XSCL<.5:1,1:0)
23 F X=0:10:XSIZ W $J(X*XSCL,3,Y)," "
24 Q
25 ;
26CPLT ;compute plot coordinates
27 S P=100,(IX(GRP),Z)=0
28 F X=-1:0 S X=$O(^TMP($J,"KM",GRP,X)) Q:X="" D CP1 S Z=X
29 S INTS(GRP)=Z S:Z>XSCL XSCL=Z S LMORT=LMORT_$D(^TMP($J,"KM",GRP,Z,1))
30 Q
31CP1 ;compute Psurv
32 I '$D(^TMP($J,"KM",GRP,X,1)) S N=N-^(0) Q
33 S Y=^TMP($J,"KM",GRP,X,1) F %=1:1:Y S N=N-1,P=P*N/(N+1)
34 S N=N-(+$G(^TMP($J,"KM",GRP,X,0))),Y=100-P\YSIZ S:Y&'$D(^TMP($J,"PLT",GRP,Y)) ^(Y)=X
35 Q
36 ;
37PLIN ;plot a line
38 N C
39 F GRP=1:1:NGRPS D:CASES(GRP) PL1
40 S Y="" F C=0:1:XSIZ S Y=Y_$S($D(C(C)):C(C),1:" ") Q:$O(C(C))=""
41 I LN#4=0 W !?5,$J(NLN-LN/NLN*100,3)," +",Y
42 E W !?9,"|",Y
43 Q
44PL1 ;setup line in C(
45 S X=$O(^TMP($J,"PLT",GRP,LN)),Z=$S(X="":INTS(GRP),1:^(X)\XADJ),NX(GRP)=Z
46 F C=IX(GRP):1:Z S C(C)=$S($D(C(C)):"*",1:$C(GRP+64))
47 I X=""&'$E(LMORT,GRP) S CASES(GRP)=0
48 E S IX(GRP)=NX(GRP)
49 Q
Note: See TracBrowser for help on using the repository browser.