ONCSGA8C ;HINES OIFO/RTK - AJCC 8th Ed Automatic Staging Tables ;01/17/19
;;2.2;ONCOLOGY;**10,12,13,18,19,20**;Jul 31, 2013;Build 5
;
;
58 ;PROSTATE
S M=$E(M,2,5)
I (($E(T,1,2)="T1")!(T="T2a")),N="N0",M="M0",PSA<10,G=1 S SG=1 Q
I T="T2",N="N0",M="M0",PSA<10,G=1 S SG=1 Q
I (($E(T,1,2)="T1")!(T="T2")!(T="T2a")),N="N0",M="M0",((PSA>10)&(PSA<20)),G=1 S SG="2A" Q
I (($E(T,1,2)="T2")),N="N0",M="M0",PSA<20,G=1 S SG="2A" Q
I (($E(T,1,2)="T1")!($E(T,1,2)="T2")),N="N0",M="M0",PSA<20,G=2 S SG="2B" Q
I (($E(T,1,2)="T1")!($E(T,1,2)="T2")),N="N0",M="M0",PSA<20,G=3 S SG="2C" Q
I (($E(T,1,2)="T1")!($E(T,1,2)="T2")),N="N0",M="M0",PSA<20,G=4 S SG="2C" Q
I (($E(T,1,2)="T1")!($E(T,1,2)="T2")),N="N0",M="M0",PSA>19,G<5 S SG="3A" Q
I (($E(T,1,2)="T3")!($E(T,1,2)="T4")),N="N0",M="M0",G<5 S SG="3B" Q
I N="N0",M="M0",G=5 S SG="3C" Q
I N="N1",M="M0" S SG="4A" Q
I M["M1" S SG="4B" Q
Q
59 ;TESTIS
S M=$E(M,2,5)
I T="Tis",N="N0",M="M0",SCAT=0 S SG=0 Q
I ((T["T1")!(T="T2")!(T="T3")!(T="T4")),N="N0",M="M0",SCAT=9 S SG=1 Q
I T["T1",N="N0",M="M0",SCAT=0 S SG="1A" Q
I T="T2",N="N0",M="M0",SCAT=0 S SG="1B" Q
I T="T3",N="N0",M="M0",SCAT=0 S SG="1B" Q
I T="T4",N="N0",M="M0",SCAT=0 S SG="1B" Q
I N="N0",M="M0",((SCAT=1)!(SCAT=2)!(SCAT=3)) S SG="1S" Q
I ((N="N1")!(N="N2")!(N="N3")),M="M0",SCAT=9 S SG=2 Q
I N="N1",M="M0",SCAT=0 S SG="2A" Q
I N="N1",M="M0",SCAT=1 S SG="2A" Q
I N="N2",M="M0",SCAT=0 S SG="2B" Q
I N="N2",M="M0",SCAT=1 S SG="2B" Q
I N="N3",M="M0",SCAT=0 S SG="2C" Q
I N="N3",M="M0",SCAT=1 S SG="2C" Q
I M="M1",SCAT=9 S SG=3 Q
I M="M1a",SCAT=0 S SG="3A" Q
I M="M1b",SCAT=1 S SG="3A" Q
I ((N="N1")!(N="N2")!(N="N3")),M="M0",SCAT=2 S SG="3B" Q
I M="M1a",SCAT=2 S SG="3B" Q
I ((N="N1")!(N="N2")!(N="N3")),M="M0",SCAT=3 S SG="3C" Q
I M="M1a",SCAT=3 S SG="3C" Q
I M="M1a",SCAT=3 S SG="3C" Q
I M="M1b" S SG="3C"
Q
60 ;KIDNEY
S M=$E(M,2,5)
I T["T1",N="N0",M="M0" S SG=1 Q
I T["T1",N="N1",M="M0" S SG=3 Q
I T["T2",N="N0",M="M0" S SG=2 Q
I T["T2",N="N1",M="M0" S SG=3 Q
I T["T3",((N="NX")!(N="N0")),M="M0" S SG=3 Q
I T["T3",N="N1",M="M0" S SG=3 Q
I T="T4",M="M0" S SG=4 Q
I M="M1" S SG=4
Q
611 ;RENAL PELVIS AND URETER
S M=$E(M,2,5)
I T="Ta",N="N0",M="M0" S SG="0a" Q
I T="Tis",N="N0",M="M0" S SG="0is" Q
I T="T1",N="N0",M="M0" S SG=1 Q
I T="T2",N="N0",M="M0" S SG=2 Q
I T="T3",N="N0",M="M0" S SG=3 Q
I T="T4",((N="NX")!(N="N0")),M="M0" S SG=4 Q
I N="N1",M="M0" S SG=4 Q
I N="N2",M="M0" S SG=4 Q
I M="M1" S SG=4
Q
612 ;
D 611
Q
621 ;URINARY BLADDER
S M=$E(M,2,5)
I T="Ta",N="N0",M="M0" S SG="0a" Q
I T="Tis",N="N0",M="M0" S SG="0is" Q
I T="T1",N="N0",M="M0" S SG=1 Q
I T="T2",N="N0",M="M0" S SG=2 Q
I T="T2a",N="N0",M="M0" S SG=2 Q
I T="T2b",N="N0",M="M0" S SG=2 Q
I ((T="T3")!(T="T3a")!(T="T3b")!(T="T4a")),N="N0",M="M0" S SG="3A" Q
I ((T["T1")!(T["T2")!(T["T3")!(T["T4")),T'="T4b",N="N1",M="M0" S SG="3A" Q
I ((T["T1")!(T["T2")!(T["T3")!(T["T4")),T'="T4b",((N="N2")!(N="N3")),M="M0" S SG="3B" Q
I T="T4b",M="M0" S SG="4A" Q
I M="M1a" S SG="4A" Q
I M="M1b" S SG="4B"
Q
622 ;
D 621
Q
631 ;URETHRA
S M=$E(M,2,5)
I T="Tis",N="N0",M="M0" S SG="0is" Q
I T="Ta",N="N0",M="M0" S SG="0a" Q
I T="T1",N="N0",M="M0" S SG=1 Q
I T="T1",N="N1",M="M0" S SG=3 Q
I T="T2",N="N0",M="M0" S SG=2 Q
I T="T2",N="N1",M="M0" S SG=3 Q
I T="T3",N="N0",M="M0" S SG=3 Q
I T="T3",N="N1",M="M0" S SG=3 Q
I T="T4",N="NX",M="M0" S SG=4 Q
I T="T4",N="N0",M="M0" S SG=4 Q
I T="T4",N="N1",M="M0" S SG=4 Q
I N="N2",M="M0" S SG=4 Q
I M="M1" S SG=4
Q
632 ;
D 631
Q
633 ;
D 631
Q
634 ;
D 631
Q
64 ;EYELID CARCINOMA
S M=$E(M,2,5)
I T="Tis",N="N0",M="M0" S SG=0 Q
I T="T1",N="N0",M="M0" S SG="1A" Q
I T="T2a",N="N0",M="M0" S SG="1B" Q
I ((T="T2b")!(T="T2c")!(T="T3")),N="N0",M="M0" S SG="2A" Q
I T="T4",N="N0",M="M0" S SG="2B" Q
I N="N1",M="M0" S SG="3A" Q
I N="N2",M="M0" S SG="3B" Q
I M="M1" S SG=4
Q
672 ;UVEA
S M=$E(M,2,5)
I T="T1a",N="N0",M="M0" S SG=1 Q
I ((T="T1b")!(T="T1c")!(T="T1d")),N="N0",M="M0" S SG="2A" Q
I T="T2a",N="N0",M="M0" S SG="2A" Q
I T="T2b",N="N0",M="M0" S SG="2B" Q
I T="T3a",N="N0",M="M0" S SG="2B" Q
I ((T="T2c")!(T="T2d")),N="N0",M="M0" S SG="3A" Q
I ((T="T3b")!(T="T3c")),N="N0",M="M0" S SG="3A" Q
I T="T4a",N="N0",M="M0" S SG="3A" Q
I T="T3d",N="N0",M="M0" S SG="3B" Q
I ((T="T4b")!(T="T4c")),N="N0",M="M0" S SG="3B" Q
I ((T="T4d")!(T="T4e")),N="N0",M="M0" S SG="3C" Q
I N="N1",M="M0" S SG=4 Q
I ((M="M1a")!(M="M1b")!(M="M1c")) S SG=4
Q
68 ;RETINOBLASTOMA - this code should work for either "C" or "P" STGIND
I ((T="T1")!(T="T2")!(T="T3")),N="N0",M="cM0" S SG=1 Q
I T="T4a",N="N0",M="cM0" S SG=2 Q
I T="T4b",N="N0",M="cM0" S SG=3 Q
I N="N1",M="cM0" S SG=3 Q
I ((M["cM1")!(M["pM1")) S SG=4 Q
I STGIND="P",T="T4",N="N0",M="cM0" S SG=2 Q
Q
731 ;THYROID
S M=$E(M,2,5)
N X D AGE^ONCOCOM Q:X="" I X<55 D Q
.I M="M0" S SG=1
.I M="M1" S SG=2
I T["T1",((N["N0")!(N="NX")),M="M0" S SG=1 Q
I T["T1",N["N1",M="M0" S SG=2 Q
I T="T2",((N["N0")!(N="NX")),M="M0" S SG=1 Q
I T="T2",N["N1",M="M0" S SG=2 Q
I ((T="T3a")!(T="T3b")),M="M0" S SG=2 Q
I T="T4a",M="M0" S SG=3 Q
I T="T4b",M="M0" S SG="4A" Q
I M="M1" S SG="4B"
Q
732 ;THYROID
S M=$E(M,2,5)
I ((T["T1")!(T["T2")!(T["T3")),T'="T3b",((N["N0")!(N="NX")),M="M0" S SG="4A" Q
I ((T["T1")!(T["T2")!(T["T3")),T'="T3b",N["N1",M="M0" S SG="4B" Q
I T="T3b",M="M0" S SG="4B" Q
I T="T4",M="M0" S SG="4B" Q
I M="M1" S SG="4C"
Q
74 ;THYROID
S M=$E(M,2,5)
I T["T1",N["N0",M="M0" S SG=1 Q
I T["T2",N["N0",M="M0" S SG=2 Q
I T["T3",N["N0",M="M0" S SG=2 Q
I ((T["T1")!(T["T2")!(T["T3")),N="N1a",M="M0" S SG=3 Q
I T="T4a",M="M0" S SG="4A" Q
I ((T["T1")!(T["T2")!(T["T3")),N="N1b",M="M0" S SG="4A" Q
I T="T4b",M="M0" S SG="4B" Q
I M="M1" S SG="4C"
Q
76 ;ADRENAL CORTICAL CARCINOMA
S M=$E(M,2,5)
I T="T1",N="N0",M="M0" S SG=1 Q
I T="T1",N="N1",M="M0" S SG=3 Q
I T="T2",N="N0",M="M0" S SG=2 Q
I T="T2",N="N1",M="M0" S SG=3 Q
I T="T3",M="M0" S SG=3 Q
I T="T4",M="M0" S SG=3 Q
I M="M1" S SG=4
Q
77 ;ADRENAL NEUROENDOCRINE
S M=$E(M,2,5)
I T="T1",N="N0",M="M0" S SG=1 Q
I T="T2",N="N0",M="M0" S SG=2 Q
I T="T1",N="N1",M="M0" S SG=3 Q
I T="T2",N="N1",M="M0" S SG=3 Q
I T="T3",M="M0" S SG=3 Q
I M["M1" S SG=4
Q
811 ;PRIMARY CUTANEOUS LYMPHOMAS
S M=$E(M,2,5)
I T["T1",N="N0",M="M0",PBI18<7 S SG="1A" Q
I T["T2",N="N0",M="M0",PBI18<7 S SG="1B" Q
I (T["T1")!(T["T2"),(N="N1")!(N="N2"),M="M0",PBI18<7 S SG="2A" Q
I T="T3",(N="N0")!(N="N1")!(N="N2"),M="M0",PBI18<7 S SG="2B" Q
I T="T4",(N="N0")!(N="N1")!(N="N2"),M="M0",PBI18<7 S SG=3 Q
I T="T4",(N="N0")!(N="N1")!(N="N2"),M="M0",PBI18<4 S SG="3A" Q
I T="T4",(N="N0")!(N="N1")!(N="N2"),M="M0",(PBI18>3)&(PBI18<7) S SG="3B" Q
I (N="N0")!(N="N1")!(N="N2"),M="M0",PBI18=7 S SG="4A1" Q
I N="N3",M="M0",PBI18<8 S SG="4A2" Q
I (N="N0")!(N="N1")!(N="N2")!(N="N3"),M="M1",PBI18<8 S SG="4B" Q
Q
;v9 UPDATES
V529 ;CERVIX UTERI -- 52 - 9TH EDITION
I T="T1",N["N0",M="M0" S SG=1 Q
I T="T1a",N["N0",M="M0" S SG="1A" Q
I T="T1a1",N["N0",M="M0" S SG="1A1" Q
I T="T1a2",N["N0",M="M0" S SG="1A2" Q
I T="T1b",N["N0",M="M1" S SG="1B" Q
I T="T1b1",N["N0",M="M0" S SG="1B1" Q
I T="T1b2",N["N0",M="M0" S SG="1B2" Q
I T="T1b3",N["N0",M="M0" S SG="1B3" Q
I T="T2",N["N0",M="M0" S SG=2 Q
I T="T2a",N["N0",M="M0" S SG="2A" Q
I T="T2a1",N["N0",M="M0" S SG="2A1" Q
I T="T2a2",N["N0",M="M0" S SG="2A2" Q
I T="T2b",N["N0",M="M0" S SG="2B" Q
I T="T3",N["N0",M="M0" S SG=3 Q
I T="T3a",N["N0",M="M0" S SG="3A" Q
I T="T3b",N["N0",M="M0" S SG="3B" Q
I T'="T4",N["N1",M="M0" S SG="3C1" Q
I T'="T4",N["N2",M="M0" S SG="3C2" Q
I T="T4",M="M0" S SG="4A" Q
I M="M1" S SG="4B"
Q
V219 ;ANUS AJCC -- 21 - 9TH EDITION V9 STAGING
I T="T1",N="N0",M="M0" S SG=1 Q
I T="T2",N="N0",M="M0" S SG="2A" Q
I T="T1",N["N1",M="M0" S SG="2B" Q
I T="T2",N["N1",M="M0" S SG="2B" Q
I T="T3",((N="N0")!(N["N1")),M="M0" S SG="3A" Q
I T="T4",N="N0",M="M0" S SG="3B" Q
I T="T4",N["N1",M="M0" S SG="3C" Q
I M="M1" S SG=4
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSGA8C 8160 printed Dec 13, 2024@02:28:29 Page 2
ONCSGA8C ;HINES OIFO/RTK - AJCC 8th Ed Automatic Staging Tables ;01/17/19
+1 ;;2.2;ONCOLOGY;**10,12,13,18,19,20**;Jul 31, 2013;Build 5
+2 ;
+3 ;
58 ;PROSTATE
+1 SET M=$EXTRACT(M,2,5)
+2 IF (($EXTRACT(T,1,2)="T1")!(T="T2a"))
IF N="N0"
IF M="M0"
IF PSA<10
IF G=1
SET SG=1
QUIT
+3 IF T="T2"
IF N="N0"
IF M="M0"
IF PSA<10
IF G=1
SET SG=1
QUIT
+4 IF (($EXTRACT(T,1,2)="T1")!(T="T2")!(T="T2a"))
IF N="N0"
IF M="M0"
IF ((PSA>10)&(PSA<20))
IF G=1
SET SG="2A"
QUIT
+5 IF (($EXTRACT(T,1,2)="T2"))
IF N="N0"
IF M="M0"
IF PSA<20
IF G=1
SET SG="2A"
QUIT
+6 IF (($EXTRACT(T,1,2)="T1")!($EXTRACT(T,1,2)="T2"))
IF N="N0"
IF M="M0"
IF PSA<20
IF G=2
SET SG="2B"
QUIT
+7 IF (($EXTRACT(T,1,2)="T1")!($EXTRACT(T,1,2)="T2"))
IF N="N0"
IF M="M0"
IF PSA<20
IF G=3
SET SG="2C"
QUIT
+8 IF (($EXTRACT(T,1,2)="T1")!($EXTRACT(T,1,2)="T2"))
IF N="N0"
IF M="M0"
IF PSA<20
IF G=4
SET SG="2C"
QUIT
+9 IF (($EXTRACT(T,1,2)="T1")!($EXTRACT(T,1,2)="T2"))
IF N="N0"
IF M="M0"
IF PSA>19
IF G<5
SET SG="3A"
QUIT
+10 IF (($EXTRACT(T,1,2)="T3")!($EXTRACT(T,1,2)="T4"))
IF N="N0"
IF M="M0"
IF G<5
SET SG="3B"
QUIT
+11 IF N="N0"
IF M="M0"
IF G=5
SET SG="3C"
QUIT
+12 IF N="N1"
IF M="M0"
SET SG="4A"
QUIT
+13 IF M["M1"
SET SG="4B"
QUIT
+14 QUIT
59 ;TESTIS
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="Tis"
IF N="N0"
IF M="M0"
IF SCAT=0
SET SG=0
QUIT
+3 IF ((T["T1")!(T="T2")!(T="T3")!(T="T4"))
IF N="N0"
IF M="M0"
IF SCAT=9
SET SG=1
QUIT
+4 IF T["T1"
IF N="N0"
IF M="M0"
IF SCAT=0
SET SG="1A"
QUIT
+5 IF T="T2"
IF N="N0"
IF M="M0"
IF SCAT=0
SET SG="1B"
QUIT
+6 IF T="T3"
IF N="N0"
IF M="M0"
IF SCAT=0
SET SG="1B"
QUIT
+7 IF T="T4"
IF N="N0"
IF M="M0"
IF SCAT=0
SET SG="1B"
QUIT
+8 IF N="N0"
IF M="M0"
IF ((SCAT=1)!(SCAT=2)!(SCAT=3))
SET SG="1S"
QUIT
+9 IF ((N="N1")!(N="N2")!(N="N3"))
IF M="M0"
IF SCAT=9
SET SG=2
QUIT
+10 IF N="N1"
IF M="M0"
IF SCAT=0
SET SG="2A"
QUIT
+11 IF N="N1"
IF M="M0"
IF SCAT=1
SET SG="2A"
QUIT
+12 IF N="N2"
IF M="M0"
IF SCAT=0
SET SG="2B"
QUIT
+13 IF N="N2"
IF M="M0"
IF SCAT=1
SET SG="2B"
QUIT
+14 IF N="N3"
IF M="M0"
IF SCAT=0
SET SG="2C"
QUIT
+15 IF N="N3"
IF M="M0"
IF SCAT=1
SET SG="2C"
QUIT
+16 IF M="M1"
IF SCAT=9
SET SG=3
QUIT
+17 IF M="M1a"
IF SCAT=0
SET SG="3A"
QUIT
+18 IF M="M1b"
IF SCAT=1
SET SG="3A"
QUIT
+19 IF ((N="N1")!(N="N2")!(N="N3"))
IF M="M0"
IF SCAT=2
SET SG="3B"
QUIT
+20 IF M="M1a"
IF SCAT=2
SET SG="3B"
QUIT
+21 IF ((N="N1")!(N="N2")!(N="N3"))
IF M="M0"
IF SCAT=3
SET SG="3C"
QUIT
+22 IF M="M1a"
IF SCAT=3
SET SG="3C"
QUIT
+23 IF M="M1a"
IF SCAT=3
SET SG="3C"
QUIT
+24 IF M="M1b"
SET SG="3C"
+25 QUIT
60 ;KIDNEY
+1 SET M=$EXTRACT(M,2,5)
+2 IF T["T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+3 IF T["T1"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+4 IF T["T2"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+5 IF T["T2"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+6 IF T["T3"
IF ((N="NX")!(N="N0"))
IF M="M0"
SET SG=3
QUIT
+7 IF T["T3"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+8 IF T="T4"
IF M="M0"
SET SG=4
QUIT
+9 IF M="M1"
SET SG=4
+10 QUIT
611 ;RENAL PELVIS AND URETER
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="Ta"
IF N="N0"
IF M="M0"
SET SG="0a"
QUIT
+3 IF T="Tis"
IF N="N0"
IF M="M0"
SET SG="0is"
QUIT
+4 IF T="T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+5 IF T="T2"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+6 IF T="T3"
IF N="N0"
IF M="M0"
SET SG=3
QUIT
+7 IF T="T4"
IF ((N="NX")!(N="N0"))
IF M="M0"
SET SG=4
QUIT
+8 IF N="N1"
IF M="M0"
SET SG=4
QUIT
+9 IF N="N2"
IF M="M0"
SET SG=4
QUIT
+10 IF M="M1"
SET SG=4
+11 QUIT
612 ;
+1 DO 611
+2 QUIT
621 ;URINARY BLADDER
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="Ta"
IF N="N0"
IF M="M0"
SET SG="0a"
QUIT
+3 IF T="Tis"
IF N="N0"
IF M="M0"
SET SG="0is"
QUIT
+4 IF T="T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+5 IF T="T2"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+6 IF T="T2a"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+7 IF T="T2b"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+8 IF ((T="T3")!(T="T3a")!(T="T3b")!(T="T4a"))
IF N="N0"
IF M="M0"
SET SG="3A"
QUIT
+9 IF ((T["T1")!(T["T2")!(T["T3")!(T["T4"))
IF T'="T4b"
IF N="N1"
IF M="M0"
SET SG="3A"
QUIT
+10 IF ((T["T1")!(T["T2")!(T["T3")!(T["T4"))
IF T'="T4b"
IF ((N="N2")!(N="N3"))
IF M="M0"
SET SG="3B"
QUIT
+11 IF T="T4b"
IF M="M0"
SET SG="4A"
QUIT
+12 IF M="M1a"
SET SG="4A"
QUIT
+13 IF M="M1b"
SET SG="4B"
+14 QUIT
622 ;
+1 DO 621
+2 QUIT
631 ;URETHRA
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="Tis"
IF N="N0"
IF M="M0"
SET SG="0is"
QUIT
+3 IF T="Ta"
IF N="N0"
IF M="M0"
SET SG="0a"
QUIT
+4 IF T="T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+5 IF T="T1"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+6 IF T="T2"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+7 IF T="T2"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+8 IF T="T3"
IF N="N0"
IF M="M0"
SET SG=3
QUIT
+9 IF T="T3"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+10 IF T="T4"
IF N="NX"
IF M="M0"
SET SG=4
QUIT
+11 IF T="T4"
IF N="N0"
IF M="M0"
SET SG=4
QUIT
+12 IF T="T4"
IF N="N1"
IF M="M0"
SET SG=4
QUIT
+13 IF N="N2"
IF M="M0"
SET SG=4
QUIT
+14 IF M="M1"
SET SG=4
+15 QUIT
632 ;
+1 DO 631
+2 QUIT
633 ;
+1 DO 631
+2 QUIT
634 ;
+1 DO 631
+2 QUIT
64 ;EYELID CARCINOMA
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="Tis"
IF N="N0"
IF M="M0"
SET SG=0
QUIT
+3 IF T="T1"
IF N="N0"
IF M="M0"
SET SG="1A"
QUIT
+4 IF T="T2a"
IF N="N0"
IF M="M0"
SET SG="1B"
QUIT
+5 IF ((T="T2b")!(T="T2c")!(T="T3"))
IF N="N0"
IF M="M0"
SET SG="2A"
QUIT
+6 IF T="T4"
IF N="N0"
IF M="M0"
SET SG="2B"
QUIT
+7 IF N="N1"
IF M="M0"
SET SG="3A"
QUIT
+8 IF N="N2"
IF M="M0"
SET SG="3B"
QUIT
+9 IF M="M1"
SET SG=4
+10 QUIT
672 ;UVEA
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="T1a"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+3 IF ((T="T1b")!(T="T1c")!(T="T1d"))
IF N="N0"
IF M="M0"
SET SG="2A"
QUIT
+4 IF T="T2a"
IF N="N0"
IF M="M0"
SET SG="2A"
QUIT
+5 IF T="T2b"
IF N="N0"
IF M="M0"
SET SG="2B"
QUIT
+6 IF T="T3a"
IF N="N0"
IF M="M0"
SET SG="2B"
QUIT
+7 IF ((T="T2c")!(T="T2d"))
IF N="N0"
IF M="M0"
SET SG="3A"
QUIT
+8 IF ((T="T3b")!(T="T3c"))
IF N="N0"
IF M="M0"
SET SG="3A"
QUIT
+9 IF T="T4a"
IF N="N0"
IF M="M0"
SET SG="3A"
QUIT
+10 IF T="T3d"
IF N="N0"
IF M="M0"
SET SG="3B"
QUIT
+11 IF ((T="T4b")!(T="T4c"))
IF N="N0"
IF M="M0"
SET SG="3B"
QUIT
+12 IF ((T="T4d")!(T="T4e"))
IF N="N0"
IF M="M0"
SET SG="3C"
QUIT
+13 IF N="N1"
IF M="M0"
SET SG=4
QUIT
+14 IF ((M="M1a")!(M="M1b")!(M="M1c"))
SET SG=4
+15 QUIT
68 ;RETINOBLASTOMA - this code should work for either "C" or "P" STGIND
+1 IF ((T="T1")!(T="T2")!(T="T3"))
IF N="N0"
IF M="cM0"
SET SG=1
QUIT
+2 IF T="T4a"
IF N="N0"
IF M="cM0"
SET SG=2
QUIT
+3 IF T="T4b"
IF N="N0"
IF M="cM0"
SET SG=3
QUIT
+4 IF N="N1"
IF M="cM0"
SET SG=3
QUIT
+5 IF ((M["cM1")!(M["pM1"))
SET SG=4
QUIT
+6 IF STGIND="P"
IF T="T4"
IF N="N0"
IF M="cM0"
SET SG=2
QUIT
+7 QUIT
731 ;THYROID
+1 SET M=$EXTRACT(M,2,5)
+2 NEW X
DO AGE^ONCOCOM
if X=""
QUIT
IF X<55
Begin DoDot:1
+3 IF M="M0"
SET SG=1
+4 IF M="M1"
SET SG=2
End DoDot:1
QUIT
+5 IF T["T1"
IF ((N["N0")!(N="NX"))
IF M="M0"
SET SG=1
QUIT
+6 IF T["T1"
IF N["N1"
IF M="M0"
SET SG=2
QUIT
+7 IF T="T2"
IF ((N["N0")!(N="NX"))
IF M="M0"
SET SG=1
QUIT
+8 IF T="T2"
IF N["N1"
IF M="M0"
SET SG=2
QUIT
+9 IF ((T="T3a")!(T="T3b"))
IF M="M0"
SET SG=2
QUIT
+10 IF T="T4a"
IF M="M0"
SET SG=3
QUIT
+11 IF T="T4b"
IF M="M0"
SET SG="4A"
QUIT
+12 IF M="M1"
SET SG="4B"
+13 QUIT
732 ;THYROID
+1 SET M=$EXTRACT(M,2,5)
+2 IF ((T["T1")!(T["T2")!(T["T3"))
IF T'="T3b"
IF ((N["N0")!(N="NX"))
IF M="M0"
SET SG="4A"
QUIT
+3 IF ((T["T1")!(T["T2")!(T["T3"))
IF T'="T3b"
IF N["N1"
IF M="M0"
SET SG="4B"
QUIT
+4 IF T="T3b"
IF M="M0"
SET SG="4B"
QUIT
+5 IF T="T4"
IF M="M0"
SET SG="4B"
QUIT
+6 IF M="M1"
SET SG="4C"
+7 QUIT
74 ;THYROID
+1 SET M=$EXTRACT(M,2,5)
+2 IF T["T1"
IF N["N0"
IF M="M0"
SET SG=1
QUIT
+3 IF T["T2"
IF N["N0"
IF M="M0"
SET SG=2
QUIT
+4 IF T["T3"
IF N["N0"
IF M="M0"
SET SG=2
QUIT
+5 IF ((T["T1")!(T["T2")!(T["T3"))
IF N="N1a"
IF M="M0"
SET SG=3
QUIT
+6 IF T="T4a"
IF M="M0"
SET SG="4A"
QUIT
+7 IF ((T["T1")!(T["T2")!(T["T3"))
IF N="N1b"
IF M="M0"
SET SG="4A"
QUIT
+8 IF T="T4b"
IF M="M0"
SET SG="4B"
QUIT
+9 IF M="M1"
SET SG="4C"
+10 QUIT
76 ;ADRENAL CORTICAL CARCINOMA
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+3 IF T="T1"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+4 IF T="T2"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+5 IF T="T2"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+6 IF T="T3"
IF M="M0"
SET SG=3
QUIT
+7 IF T="T4"
IF M="M0"
SET SG=3
QUIT
+8 IF M="M1"
SET SG=4
+9 QUIT
77 ;ADRENAL NEUROENDOCRINE
+1 SET M=$EXTRACT(M,2,5)
+2 IF T="T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+3 IF T="T2"
IF N="N0"
IF M="M0"
SET SG=2
QUIT
+4 IF T="T1"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+5 IF T="T2"
IF N="N1"
IF M="M0"
SET SG=3
QUIT
+6 IF T="T3"
IF M="M0"
SET SG=3
QUIT
+7 IF M["M1"
SET SG=4
+8 QUIT
811 ;PRIMARY CUTANEOUS LYMPHOMAS
+1 SET M=$EXTRACT(M,2,5)
+2 IF T["T1"
IF N="N0"
IF M="M0"
IF PBI18<7
SET SG="1A"
QUIT
+3 IF T["T2"
IF N="N0"
IF M="M0"
IF PBI18<7
SET SG="1B"
QUIT
+4 IF (T["T1")!(T["T2")
IF (N="N1")!(N="N2")
IF M="M0"
IF PBI18<7
SET SG="2A"
QUIT
+5 IF T="T3"
IF (N="N0")!(N="N1")!(N="N2")
IF M="M0"
IF PBI18<7
SET SG="2B"
QUIT
+6 IF T="T4"
IF (N="N0")!(N="N1")!(N="N2")
IF M="M0"
IF PBI18<7
SET SG=3
QUIT
+7 IF T="T4"
IF (N="N0")!(N="N1")!(N="N2")
IF M="M0"
IF PBI18<4
SET SG="3A"
QUIT
+8 IF T="T4"
IF (N="N0")!(N="N1")!(N="N2")
IF M="M0"
IF (PBI18>3)&(PBI18<7)
SET SG="3B"
QUIT
+9 IF (N="N0")!(N="N1")!(N="N2")
IF M="M0"
IF PBI18=7
SET SG="4A1"
QUIT
+10 IF N="N3"
IF M="M0"
IF PBI18<8
SET SG="4A2"
QUIT
+11 IF (N="N0")!(N="N1")!(N="N2")!(N="N3")
IF M="M1"
IF PBI18<8
SET SG="4B"
QUIT
+12 QUIT
+13 ;v9 UPDATES
V529 ;CERVIX UTERI -- 52 - 9TH EDITION
+1 IF T="T1"
IF N["N0"
IF M="M0"
SET SG=1
QUIT
+2 IF T="T1a"
IF N["N0"
IF M="M0"
SET SG="1A"
QUIT
+3 IF T="T1a1"
IF N["N0"
IF M="M0"
SET SG="1A1"
QUIT
+4 IF T="T1a2"
IF N["N0"
IF M="M0"
SET SG="1A2"
QUIT
+5 IF T="T1b"
IF N["N0"
IF M="M1"
SET SG="1B"
QUIT
+6 IF T="T1b1"
IF N["N0"
IF M="M0"
SET SG="1B1"
QUIT
+7 IF T="T1b2"
IF N["N0"
IF M="M0"
SET SG="1B2"
QUIT
+8 IF T="T1b3"
IF N["N0"
IF M="M0"
SET SG="1B3"
QUIT
+9 IF T="T2"
IF N["N0"
IF M="M0"
SET SG=2
QUIT
+10 IF T="T2a"
IF N["N0"
IF M="M0"
SET SG="2A"
QUIT
+11 IF T="T2a1"
IF N["N0"
IF M="M0"
SET SG="2A1"
QUIT
+12 IF T="T2a2"
IF N["N0"
IF M="M0"
SET SG="2A2"
QUIT
+13 IF T="T2b"
IF N["N0"
IF M="M0"
SET SG="2B"
QUIT
+14 IF T="T3"
IF N["N0"
IF M="M0"
SET SG=3
QUIT
+15 IF T="T3a"
IF N["N0"
IF M="M0"
SET SG="3A"
QUIT
+16 IF T="T3b"
IF N["N0"
IF M="M0"
SET SG="3B"
QUIT
+17 IF T'="T4"
IF N["N1"
IF M="M0"
SET SG="3C1"
QUIT
+18 IF T'="T4"
IF N["N2"
IF M="M0"
SET SG="3C2"
QUIT
+19 IF T="T4"
IF M="M0"
SET SG="4A"
QUIT
+20 IF M="M1"
SET SG="4B"
+21 QUIT
V219 ;ANUS AJCC -- 21 - 9TH EDITION V9 STAGING
+1 IF T="T1"
IF N="N0"
IF M="M0"
SET SG=1
QUIT
+2 IF T="T2"
IF N="N0"
IF M="M0"
SET SG="2A"
QUIT
+3 IF T="T1"
IF N["N1"
IF M="M0"
SET SG="2B"
QUIT
+4 IF T="T2"
IF N["N1"
IF M="M0"
SET SG="2B"
QUIT
+5 IF T="T3"
IF ((N="N0")!(N["N1"))
IF M="M0"
SET SG="3A"
QUIT
+6 IF T="T4"
IF N="N0"
IF M="M0"
SET SG="3B"
QUIT
+7 IF T="T4"
IF N["N1"
IF M="M0"
SET SG="3C"
QUIT
+8 IF M="M1"
SET SG=4
+9 QUIT