ONCSG3 ;Hines OIFO/GWB - Automatic Staging Tables ;02/23/11
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;SKIN
;
CS ;Carcinoma of the Skin - 3rd, 4th, 5th and 6th editions
K SG
I $E(M)=1 S SG=4
E I $E(M)=0 D SKNRP
I '$D(SG) S SG=99
Q
SKNRP ;Carcinoma of the Skin
I $E(N)=1 S SG=3
E I $E(N)=0 D
.I T="IS" S SG=0
.E I T=1 S SG=1
.E I (T=2)!(T=3) S SG=2
.E I T=4 S SG=3
Q
;
CSC ;Cutaneous Squamous Cell/Other Cutaneous Carcinoma - 7th edition
I $E(HT,1,4)=8247,ONCOED=7 G MCC
S TNM=T_$E(N,1)_M
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM=300 S SG=3 Q ;III T3 N0 M0
.I TNM=110 S SG=3 Q ; T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I TNM=120 S SG=4 Q ;IV T1 N2 M0
.I TNM=220 S SG=4 Q ; T2 N2 M0
.I TNM=320 S SG=4 Q ; T3 N2 M0
.I N=3,M=0 S SG=4 Q ; Any T N3 M0
.I T=4,M=0 S SG=4 Q ; T4 Any N M0
.I M=1 S SG=4 Q ; Any T Any N M1
;
MCC ;Merkel Cell Carcinoma - 7th edition
I STGIND="C" D MCCC Q
I STGIND="P" D MCCP Q
Q
;
MCCC ;Merkel Cell Carcinoma - 7th edition (Clinical Stage Grouping)
S TNM=T_N_$E(M,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG="1B" Q ;IB T1 N0 M0
.I TNM=200 S SG="2B" Q ;IIB T2 N0 M0
.I TNM=300 S SG="2B" Q ; T3 N0 M0
.I TNM=400 S SG="2C" Q ;IIC T4 N0 M0
.I N="1A",M=0 S SG="3A" Q ;IIIA Any T N1a M0
.I N=1,M=0 S SG="3B" Q ;IIIB Any T N1 M0
.I N="1B",M=0 S SG="3B" Q ; Any T N1b M0
.I N=2,M=0 S SG="3B" Q ; Any T N2 M0
.I $E(M,1)=1 S SG=4 Q ;IV Any T Any N M1
;
MCCP ;Merkel Cell Carcinoma - 7th edition (Pathologic Stage Grouping)
N CLINN
S CLINN=$P($G(^ONCO(165.5,D0,2)),U,26)
S TNM=T_N_$E(M,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG="1A" Q ;IA T1 pN0 M0
.I T=1,N="X",CLINN=0,M=0 S SG="1B" Q ;IB T1 cN0 M0
.I TNM=200 S SG="2A" Q ;IIA T2 pN0 M0
.I TNM=300 S SG="2A" Q ; T3 pN0 M0
.I T=2,N="X",CLINN=0,M=0 S SG="2B" Q ;IIB T2 cN0 M0
.I T=3,N="X",CLINN=0,M=0 S SG="2B" Q ; T3 cN0 M0
.I TNM=400 S SG="2C" Q ;IIC T4 N0 M0
.I N="1A",M=0 S SG="3A" Q ;IIIA Any T N1a M0
.I N="1B",M=0 S SG="3B" Q ;IIIB Any T N1b M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
MMS3 ;Melanoma of the Skin - 3rd edition
I M[1 S SG=4
E I (T[1)!(T[2)!(T[3),N[0,M[0 S SG=+T
E I N,M[0 S SG=3
E S SG=99
Q
;
MMS4 ;Malignant Melanoma of the Skin - 4th edition
S SG=99
I M[1 S SG=4
E I (N[1)!(N[2),M[0 S SG=3
E I N[0,M[0 S SG=$S((T[3)!(T[4):2,(T[1)!(T[2):1,T["IS":0,1:99)
Q
;
MMS5 ;Malignant Melanoma of the Skin - 5th edition
I T="IS" S TNM=T_$E(N,1)_$E(M,1)
E S TNM=$E(T,1)_$E(N,1)_$E(M,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=1 Q ; T2 N0 M0
.I TNM=300 S SG=2 Q ;II T3 N0 M0
.I TNM=400 S SG=3 Q ;III T4 N0 M0
.I $E(N,1)=1,M=0 S SG=3 Q ; Any T N1 M0
.I $E(N,1)=2,M=0 S SG=3 Q ; Any T N2 M0
.I $E(M,1)=1 S SG=4 Q ;IV Any T Any N M1
;
MMS6 ;Melanoma of the Skin - 6th edition
I STGIND="C" D MMS6C Q
I STGIND="P" D MMS6P Q
Q
;
MMS6C ;Melanoma of the Skin - 6th edition (Clinical Stage Grouping)
S TNM=T_$E(N,1)_$E(M,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM="1A00" S SG="1A" Q ;IA T1a N0 M0
.I TNM="1B00" S SG="1B" Q ;IB T1b N0 M0
.I TNM="2A00" S SG="1B" Q ; T2a N0 M0
.I TNM="2B00" S SG="2A" Q ;IIA T2b N0 M0
.I TNM="3A00" S SG="2A" Q ; T3a N0 M0
.I TNM="3B00" S SG="2B" Q ;IIB T3b N0 M0
.I TNM="4A00" S SG="2B" Q ; T4a N0 M0
.I TNM="4B00" S SG="2C" Q ;IIC T4b N0 M0
.I $E(N,1)=1,M=0 S SG=3 Q ;III Any T N1 M0
.I $E(N,1)=2,M=0 S SG=3 Q ; Any T N2 M0
.I $E(N,1)=3,M=0 S SG=3 Q ; Any T N3 M0
.I $E(M,1)=1 S SG=4 Q ;IV Any T Any N M1
;
MMS6P ;Melanoma of the Skin - 6th edition (Pathologic Stage Grouping)
S TNM=T_N_$E(M,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM="1A00" S SG="1A" Q ;IA T1a N0 M0
.I TNM="1B00" S SG="1B" Q ;IB T1b N0 M0
.I TNM="2A00" S SG="1B" Q ; T2a N0 M0
.I TNM="2B00" S SG="2A" Q ;IIA T2b N0 M0
.I TNM="3A00" S SG="2A" Q ; T3a N0 M0
.I TNM="3B00" S SG="2B" Q ;IIB T3b N0 M0
.I TNM="4A00" S SG="2B" Q ; T4a N0 M0
.I TNM="4B00" S SG="2C" Q ;IIC T4b N0 M0
.I TNM="1A1A0" S SG="3A" Q ;IIIA T1a N1a M0
.I TNM="2A1A0" S SG="3A" Q ; T2a N1a M0
.I TNM="3A1A0" S SG="3A" Q ; T3a N1a M0
.I TNM="4A1A0" S SG="3A" Q ; T4a N1a M0
.I TNM="1A2A0" S SG="3A" Q ; T1a N2a M0
.I TNM="2A2A0" S SG="3A" Q ; T2a N2a M0
.I TNM="3A2A0" S SG="3A" Q ; T3a N2a M0
.I TNM="4A2A0" S SG="3A" Q ; T4a N2a M0
.I TNM="1B1A0" S SG="3B" Q ;IIIB T1b N1a M0
.I TNM="2B1A0" S SG="3B" Q ; T2b N1a M0
.I TNM="3B1A0" S SG="3B" Q ; T3b N1a M0
.I TNM="4B1A0" S SG="3B" Q ; T4b N1a M0
.I TNM="1B2A0" S SG="3B" Q ; T1b N2a M0
.I TNM="2B2A0" S SG="3B" Q ; T2b N2a M0
.I TNM="3B2A0" S SG="3B" Q ; T3b N2a M0
.I TNM="4B2A0" S SG="3B" Q ; T4b N2a M0
.I TNM="1A1B0" S SG="3B" Q ; T1a N1b M0
.I TNM="2A1B0" S SG="3B" Q ; T2a N1b M0
.I TNM="3A1B0" S SG="3B" Q ; T3a N1b M0
.I TNM="4A1B0" S SG="3B" Q ; T4a N1b M0
.I TNM="1A2B0" S SG="3B" Q ; T1a N2b M0
.I TNM="2A2B0" S SG="3B" Q ; T2a N2b M0
.I TNM="3A2B0" S SG="3B" Q ; T3a N2b M0
.I TNM="4A2B0" S SG="3B" Q ; T4a N2b M0
.I TNM="1A2C0" S SG="3B" Q ; T1a N2c M0
.I TNM="2A2C0" S SG="3B" Q ; T2a N2c M0
.I TNM="3A2C0" S SG="3B" Q ; T3a N2c M0
.I TNM="4A2C0" S SG="3B" Q ; T4a N2c M0
.I TNM="1B2C0" S SG="3B" Q ; T1b N2c M0
.I TNM="2B2C0" S SG="3B" Q ; T2b N2c M0
.I TNM="3B2C0" S SG="3B" Q ; T3b N2c M0
.I TNM="4B2C0" S SG="3B" Q ; T4b N2c M0
.I TNM="1B1B0" S SG="3C" Q ;IIIC T1b N1b M0
.I TNM="2B1B0" S SG="3C" Q ; T2b N1b M0
.I TNM="3B1B0" S SG="3C" Q ; T3b N1b M0
.I TNM="4B1B0" S SG="3C" Q ; T4b N1b M0
.I TNM="1B2B0" S SG="3C" Q ; T1b N2b M0
.I TNM="2B2B0" S SG="3C" Q ; T2b N2b M0
.I TNM="3B2B0" S SG="3C" Q ; T3b N2b M0
.I TNM="4B2B0" S SG="3C" Q ; T4b N2b M0
.I N=3,M=0 S SG="3C" Q ; Any T N3 M0
.I $E(M,1)=1 S SG=4 Q ;IV Any T Any N M1
;
;BREAST
;
BRST345 ;Breast - 3rd, 4th and 5th editions
I $E(M)=1 S SG=4
E I ($E(N)=3)!($E(T)=4),$E(M)=0 S SG="3B"
E I $E(T,1,2)="IS",$E(N)=0,$E(M)=0 S SG=0
E I $E(T)=1,$E(N)=0,$E(M)=0 S SG=1
E I ($E(T)=0)!($E(T)=1),$E(N)=1,$E(M)=0 S SG="2A"
E I $E(T)=2,$E(N)=0,$E(M)=0 S SG="2A"
E I $E(T)=2,$E(N)=1,$E(M)=0 S SG="2B"
E I $E(T)=3,$E(N)=0,$E(M)=0 S SG="2B"
E I ($E(T)=0)!($E(T)=1)!($E(T)=2)!($E(T)=3),$E(N)=2,$E(M)=0 S SG="3A"
E I $E(T)=3,$E(N)=1,$E(M)=0 S SG="3A"
E S SG=99
Q
;
BRST6 ;Breast - 6th edition
I T="IS" S TNM=T_$E(N,1)_$E(M,1)
E S TNM=$E(T,1)_$E(N,1)_$E(M,1)
S N=$E(N,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM="010" S SG="2A" Q ;IIA T0 N1 M0
.I TNM=110 S SG="2A" Q ; T1 N1 M0
.I TNM=200 S SG="2A" Q ; T2 N0 M0
.I TNM=210 S SG="2B" Q ;IIB T2 N1 M0
.I TNM=300 S SG="2B" Q ; T3 N0 M0
.I TNM="020" S SG="3A" Q ;IIIA T0 N2 M0
.I TNM=120 S SG="3A" Q ; T1 N2 M0
.I TNM=220 S SG="3A" Q ; T2 N2 M0
.I TNM=310 S SG="3A" Q ; T3 N1 M0
.I TNM=320 S SG="3A" Q ; T3 N2 M0
.I TNM=400 S SG="3B" Q ;IIIB T4 N0 M0
.I TNM=410 S SG="3B" Q ; T4 N1 M0
.I TNM=420 S SG="3B" Q ; T4 N2 M0
.I N=3,M=0 S SG="3C" Q ;IIIC Any T N3 M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
BRST7 ;Breast - 7th edition
I T="IS" S TNM=T_$E(N,1)_$E(M,1)
E S TNM=$E(T,1)_$E(N,1)_$E(M,1)
D K TNM Q
.I TNM="IS00" S SG=0 Q ;0 Tis N0 M0
.I TNM=100 S SG="1A" Q ;IA T1 N0 M0
.I T=0,N="1MI",M=0 S SG="1B" Q ;IB T0 N1mi M0
.I T=1,N="1MI",M=0 S SG="1B" Q ; T1 N1mi M0
.I TNM="010" S SG="2A" Q ;IIA T0 N1 M0
.I TNM=110 S SG="2A" Q ; T1 N1 M0
.I TNM=200 S SG="2A" Q ; T2 N0 M0
.I TNM=210 S SG="2B" Q ;IIB T2 N1 M0
.I TNM=300 S SG="2B" Q ; T3 N0 M0
.I TNM="020" S SG="3A" Q ;IIIA T0 N2 M0
.I TNM=120 S SG="3A" Q ; T1 N2 M0
.I TNM=220 S SG="3A" Q ; T2 N2 M0
.I TNM=310 S SG="3A" Q ; T3 N1 M0
.I TNM=320 S SG="3A" Q ; T3 N2 M0
.I TNM=400 S SG="3B" Q ;IIIB T4 N0 M0
.I TNM=410 S SG="3B" Q ; T4 N1 M0
.I TNM=420 S SG="3B" Q ; T4 N2 M0
.I $E(N,1)=3,M=0 S SG="3C" Q ;IIIC Any T N3 M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
CLEANUP ;Cleanup
K D0,HT,M,N,ONCOED,STGIND,T
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSG3 9985 printed Dec 13, 2024@02:28:23 Page 2
ONCSG3 ;Hines OIFO/GWB - Automatic Staging Tables ;02/23/11
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;SKIN
+4 ;
CS ;Carcinoma of the Skin - 3rd, 4th, 5th and 6th editions
+1 KILL SG
+2 IF $EXTRACT(M)=1
SET SG=4
+3 IF '$TEST
IF $EXTRACT(M)=0
DO SKNRP
+4 IF '$DATA(SG)
SET SG=99
+5 QUIT
SKNRP ;Carcinoma of the Skin
+1 IF $EXTRACT(N)=1
SET SG=3
+2 IF '$TEST
IF $EXTRACT(N)=0
Begin DoDot:1
+3 IF T="IS"
SET SG=0
+4 IF '$TEST
IF T=1
SET SG=1
+5 IF '$TEST
IF (T=2)!(T=3)
SET SG=2
+6 IF '$TEST
IF T=4
SET SG=3
End DoDot:1
+7 QUIT
+8 ;
CSC ;Cutaneous Squamous Cell/Other Cutaneous Carcinoma - 7th edition
+1 IF $EXTRACT(HT,1,4)=8247
IF ONCOED=7
GOTO MCC
+2 SET TNM=T_$EXTRACT(N,1)_M
+3 Begin DoDot:1
+4 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+5 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+6 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+7 ;III T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+8 ; T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+9 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+10 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+11 ;IV T1 N2 M0
IF TNM=120
SET SG=4
QUIT
+12 ; T2 N2 M0
IF TNM=220
SET SG=4
QUIT
+13 ; T3 N2 M0
IF TNM=320
SET SG=4
QUIT
+14 ; Any T N3 M0
IF N=3
IF M=0
SET SG=4
QUIT
+15 ; T4 Any N M0
IF T=4
IF M=0
SET SG=4
QUIT
+16 ; Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+17 ;
MCC ;Merkel Cell Carcinoma - 7th edition
+1 IF STGIND="C"
DO MCCC
QUIT
+2 IF STGIND="P"
DO MCCP
QUIT
+3 QUIT
+4 ;
MCCC ;Merkel Cell Carcinoma - 7th edition (Clinical Stage Grouping)
+1 SET TNM=T_N_$EXTRACT(M,1)
+2 Begin DoDot:1
+3 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+4 ;IB T1 N0 M0
IF TNM=100
SET SG="1B"
QUIT
+5 ;IIB T2 N0 M0
IF TNM=200
SET SG="2B"
QUIT
+6 ; T3 N0 M0
IF TNM=300
SET SG="2B"
QUIT
+7 ;IIC T4 N0 M0
IF TNM=400
SET SG="2C"
QUIT
+8 ;IIIA Any T N1a M0
IF N="1A"
IF M=0
SET SG="3A"
QUIT
+9 ;IIIB Any T N1 M0
IF N=1
IF M=0
SET SG="3B"
QUIT
+10 ; Any T N1b M0
IF N="1B"
IF M=0
SET SG="3B"
QUIT
+11 ; Any T N2 M0
IF N=2
IF M=0
SET SG="3B"
QUIT
+12 ;IV Any T Any N M1
IF $EXTRACT(M,1)=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+13 ;
MCCP ;Merkel Cell Carcinoma - 7th edition (Pathologic Stage Grouping)
+1 NEW CLINN
+2 SET CLINN=$PIECE($GET(^ONCO(165.5,D0,2)),U,26)
+3 SET TNM=T_N_$EXTRACT(M,1)
+4 Begin DoDot:1
+5 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+6 ;IA T1 pN0 M0
IF TNM=100
SET SG="1A"
QUIT
+7 ;IB T1 cN0 M0
IF T=1
IF N="X"
IF CLINN=0
IF M=0
SET SG="1B"
QUIT
+8 ;IIA T2 pN0 M0
IF TNM=200
SET SG="2A"
QUIT
+9 ; T3 pN0 M0
IF TNM=300
SET SG="2A"
QUIT
+10 ;IIB T2 cN0 M0
IF T=2
IF N="X"
IF CLINN=0
IF M=0
SET SG="2B"
QUIT
+11 ; T3 cN0 M0
IF T=3
IF N="X"
IF CLINN=0
IF M=0
SET SG="2B"
QUIT
+12 ;IIC T4 N0 M0
IF TNM=400
SET SG="2C"
QUIT
+13 ;IIIA Any T N1a M0
IF N="1A"
IF M=0
SET SG="3A"
QUIT
+14 ;IIIB Any T N1b M0
IF N="1B"
IF M=0
SET SG="3B"
QUIT
+15 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+16 ;
MMS3 ;Melanoma of the Skin - 3rd edition
+1 IF M[1
SET SG=4
+2 IF '$TEST
IF (T[1)!(T[2)!(T[3)
IF N[0
IF M[0
SET SG=+T
+3 IF '$TEST
IF N
IF M[0
SET SG=3
+4 IF '$TEST
SET SG=99
+5 QUIT
+6 ;
MMS4 ;Malignant Melanoma of the Skin - 4th edition
+1 SET SG=99
+2 IF M[1
SET SG=4
+3 IF '$TEST
IF (N[1)!(N[2)
IF M[0
SET SG=3
+4 IF '$TEST
IF N[0
IF M[0
SET SG=$SELECT((T[3)!(T[4):2,(T[1)!(T[2):1,T["IS":0,1:99)
+5 QUIT
+6 ;
MMS5 ;Malignant Melanoma of the Skin - 5th edition
+1 IF T="IS"
SET TNM=T_$EXTRACT(N,1)_$EXTRACT(M,1)
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_$EXTRACT(N,1)_$EXTRACT(M,1)
+3 Begin DoDot:1
+4 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+5 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+6 ; T2 N0 M0
IF TNM=200
SET SG=1
QUIT
+7 ;II T3 N0 M0
IF TNM=300
SET SG=2
QUIT
+8 ;III T4 N0 M0
IF TNM=400
SET SG=3
QUIT
+9 ; Any T N1 M0
IF $EXTRACT(N,1)=1
IF M=0
SET SG=3
QUIT
+10 ; Any T N2 M0
IF $EXTRACT(N,1)=2
IF M=0
SET SG=3
QUIT
+11 ;IV Any T Any N M1
IF $EXTRACT(M,1)=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+12 ;
MMS6 ;Melanoma of the Skin - 6th edition
+1 IF STGIND="C"
DO MMS6C
QUIT
+2 IF STGIND="P"
DO MMS6P
QUIT
+3 QUIT
+4 ;
MMS6C ;Melanoma of the Skin - 6th edition (Clinical Stage Grouping)
+1 SET TNM=T_$EXTRACT(N,1)_$EXTRACT(M,1)
+2 Begin DoDot:1
+3 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+4 ;IA T1a N0 M0
IF TNM="1A00"
SET SG="1A"
QUIT
+5 ;IB T1b N0 M0
IF TNM="1B00"
SET SG="1B"
QUIT
+6 ; T2a N0 M0
IF TNM="2A00"
SET SG="1B"
QUIT
+7 ;IIA T2b N0 M0
IF TNM="2B00"
SET SG="2A"
QUIT
+8 ; T3a N0 M0
IF TNM="3A00"
SET SG="2A"
QUIT
+9 ;IIB T3b N0 M0
IF TNM="3B00"
SET SG="2B"
QUIT
+10 ; T4a N0 M0
IF TNM="4A00"
SET SG="2B"
QUIT
+11 ;IIC T4b N0 M0
IF TNM="4B00"
SET SG="2C"
QUIT
+12 ;III Any T N1 M0
IF $EXTRACT(N,1)=1
IF M=0
SET SG=3
QUIT
+13 ; Any T N2 M0
IF $EXTRACT(N,1)=2
IF M=0
SET SG=3
QUIT
+14 ; Any T N3 M0
IF $EXTRACT(N,1)=3
IF M=0
SET SG=3
QUIT
+15 ;IV Any T Any N M1
IF $EXTRACT(M,1)=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+16 ;
MMS6P ;Melanoma of the Skin - 6th edition (Pathologic Stage Grouping)
+1 SET TNM=T_N_$EXTRACT(M,1)
+2 Begin DoDot:1
+3 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+4 ;IA T1a N0 M0
IF TNM="1A00"
SET SG="1A"
QUIT
+5 ;IB T1b N0 M0
IF TNM="1B00"
SET SG="1B"
QUIT
+6 ; T2a N0 M0
IF TNM="2A00"
SET SG="1B"
QUIT
+7 ;IIA T2b N0 M0
IF TNM="2B00"
SET SG="2A"
QUIT
+8 ; T3a N0 M0
IF TNM="3A00"
SET SG="2A"
QUIT
+9 ;IIB T3b N0 M0
IF TNM="3B00"
SET SG="2B"
QUIT
+10 ; T4a N0 M0
IF TNM="4A00"
SET SG="2B"
QUIT
+11 ;IIC T4b N0 M0
IF TNM="4B00"
SET SG="2C"
QUIT
+12 ;IIIA T1a N1a M0
IF TNM="1A1A0"
SET SG="3A"
QUIT
+13 ; T2a N1a M0
IF TNM="2A1A0"
SET SG="3A"
QUIT
+14 ; T3a N1a M0
IF TNM="3A1A0"
SET SG="3A"
QUIT
+15 ; T4a N1a M0
IF TNM="4A1A0"
SET SG="3A"
QUIT
+16 ; T1a N2a M0
IF TNM="1A2A0"
SET SG="3A"
QUIT
+17 ; T2a N2a M0
IF TNM="2A2A0"
SET SG="3A"
QUIT
+18 ; T3a N2a M0
IF TNM="3A2A0"
SET SG="3A"
QUIT
+19 ; T4a N2a M0
IF TNM="4A2A0"
SET SG="3A"
QUIT
+20 ;IIIB T1b N1a M0
IF TNM="1B1A0"
SET SG="3B"
QUIT
+21 ; T2b N1a M0
IF TNM="2B1A0"
SET SG="3B"
QUIT
+22 ; T3b N1a M0
IF TNM="3B1A0"
SET SG="3B"
QUIT
+23 ; T4b N1a M0
IF TNM="4B1A0"
SET SG="3B"
QUIT
+24 ; T1b N2a M0
IF TNM="1B2A0"
SET SG="3B"
QUIT
+25 ; T2b N2a M0
IF TNM="2B2A0"
SET SG="3B"
QUIT
+26 ; T3b N2a M0
IF TNM="3B2A0"
SET SG="3B"
QUIT
+27 ; T4b N2a M0
IF TNM="4B2A0"
SET SG="3B"
QUIT
+28 ; T1a N1b M0
IF TNM="1A1B0"
SET SG="3B"
QUIT
+29 ; T2a N1b M0
IF TNM="2A1B0"
SET SG="3B"
QUIT
+30 ; T3a N1b M0
IF TNM="3A1B0"
SET SG="3B"
QUIT
+31 ; T4a N1b M0
IF TNM="4A1B0"
SET SG="3B"
QUIT
+32 ; T1a N2b M0
IF TNM="1A2B0"
SET SG="3B"
QUIT
+33 ; T2a N2b M0
IF TNM="2A2B0"
SET SG="3B"
QUIT
+34 ; T3a N2b M0
IF TNM="3A2B0"
SET SG="3B"
QUIT
+35 ; T4a N2b M0
IF TNM="4A2B0"
SET SG="3B"
QUIT
+36 ; T1a N2c M0
IF TNM="1A2C0"
SET SG="3B"
QUIT
+37 ; T2a N2c M0
IF TNM="2A2C0"
SET SG="3B"
QUIT
+38 ; T3a N2c M0
IF TNM="3A2C0"
SET SG="3B"
QUIT
+39 ; T4a N2c M0
IF TNM="4A2C0"
SET SG="3B"
QUIT
+40 ; T1b N2c M0
IF TNM="1B2C0"
SET SG="3B"
QUIT
+41 ; T2b N2c M0
IF TNM="2B2C0"
SET SG="3B"
QUIT
+42 ; T3b N2c M0
IF TNM="3B2C0"
SET SG="3B"
QUIT
+43 ; T4b N2c M0
IF TNM="4B2C0"
SET SG="3B"
QUIT
+44 ;IIIC T1b N1b M0
IF TNM="1B1B0"
SET SG="3C"
QUIT
+45 ; T2b N1b M0
IF TNM="2B1B0"
SET SG="3C"
QUIT
+46 ; T3b N1b M0
IF TNM="3B1B0"
SET SG="3C"
QUIT
+47 ; T4b N1b M0
IF TNM="4B1B0"
SET SG="3C"
QUIT
+48 ; T1b N2b M0
IF TNM="1B2B0"
SET SG="3C"
QUIT
+49 ; T2b N2b M0
IF TNM="2B2B0"
SET SG="3C"
QUIT
+50 ; T3b N2b M0
IF TNM="3B2B0"
SET SG="3C"
QUIT
+51 ; T4b N2b M0
IF TNM="4B2B0"
SET SG="3C"
QUIT
+52 ; Any T N3 M0
IF N=3
IF M=0
SET SG="3C"
QUIT
+53 ;IV Any T Any N M1
IF $EXTRACT(M,1)=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+54 ;
+55 ;BREAST
+56 ;
BRST345 ;Breast - 3rd, 4th and 5th editions
+1 IF $EXTRACT(M)=1
SET SG=4
+2 IF '$TEST
IF ($EXTRACT(N)=3)!($EXTRACT(T)=4)
IF $EXTRACT(M)=0
SET SG="3B"
+3 IF '$TEST
IF $EXTRACT(T,1,2)="IS"
IF $EXTRACT(N)=0
IF $EXTRACT(M)=0
SET SG=0
+4 IF '$TEST
IF $EXTRACT(T)=1
IF $EXTRACT(N)=0
IF $EXTRACT(M)=0
SET SG=1
+5 IF '$TEST
IF ($EXTRACT(T)=0)!($EXTRACT(T)=1)
IF $EXTRACT(N)=1
IF $EXTRACT(M)=0
SET SG="2A"
+6 IF '$TEST
IF $EXTRACT(T)=2
IF $EXTRACT(N)=0
IF $EXTRACT(M)=0
SET SG="2A"
+7 IF '$TEST
IF $EXTRACT(T)=2
IF $EXTRACT(N)=1
IF $EXTRACT(M)=0
SET SG="2B"
+8 IF '$TEST
IF $EXTRACT(T)=3
IF $EXTRACT(N)=0
IF $EXTRACT(M)=0
SET SG="2B"
+9 IF '$TEST
IF ($EXTRACT(T)=0)!($EXTRACT(T)=1)!($EXTRACT(T)=2)!($EXTRACT(T)=3)
IF $EXTRACT(N)=2
IF $EXTRACT(M)=0
SET SG="3A"
+10 IF '$TEST
IF $EXTRACT(T)=3
IF $EXTRACT(N)=1
IF $EXTRACT(M)=0
SET SG="3A"
+11 IF '$TEST
SET SG=99
+12 QUIT
+13 ;
BRST6 ;Breast - 6th edition
+1 IF T="IS"
SET TNM=T_$EXTRACT(N,1)_$EXTRACT(M,1)
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_$EXTRACT(N,1)_$EXTRACT(M,1)
+3 SET N=$EXTRACT(N,1)
+4 Begin DoDot:1
+5 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+6 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+7 ;IIA T0 N1 M0
IF TNM="010"
SET SG="2A"
QUIT
+8 ; T1 N1 M0
IF TNM=110
SET SG="2A"
QUIT
+9 ; T2 N0 M0
IF TNM=200
SET SG="2A"
QUIT
+10 ;IIB T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+11 ; T3 N0 M0
IF TNM=300
SET SG="2B"
QUIT
+12 ;IIIA T0 N2 M0
IF TNM="020"
SET SG="3A"
QUIT
+13 ; T1 N2 M0
IF TNM=120
SET SG="3A"
QUIT
+14 ; T2 N2 M0
IF TNM=220
SET SG="3A"
QUIT
+15 ; T3 N1 M0
IF TNM=310
SET SG="3A"
QUIT
+16 ; T3 N2 M0
IF TNM=320
SET SG="3A"
QUIT
+17 ;IIIB T4 N0 M0
IF TNM=400
SET SG="3B"
QUIT
+18 ; T4 N1 M0
IF TNM=410
SET SG="3B"
QUIT
+19 ; T4 N2 M0
IF TNM=420
SET SG="3B"
QUIT
+20 ;IIIC Any T N3 M0
IF N=3
IF M=0
SET SG="3C"
QUIT
+21 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+22 ;
BRST7 ;Breast - 7th edition
+1 IF T="IS"
SET TNM=T_$EXTRACT(N,1)_$EXTRACT(M,1)
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_$EXTRACT(N,1)_$EXTRACT(M,1)
+3 Begin DoDot:1
+4 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+5 ;IA T1 N0 M0
IF TNM=100
SET SG="1A"
QUIT
+6 ;IB T0 N1mi M0
IF T=0
IF N="1MI"
IF M=0
SET SG="1B"
QUIT
+7 ; T1 N1mi M0
IF T=1
IF N="1MI"
IF M=0
SET SG="1B"
QUIT
+8 ;IIA T0 N1 M0
IF TNM="010"
SET SG="2A"
QUIT
+9 ; T1 N1 M0
IF TNM=110
SET SG="2A"
QUIT
+10 ; T2 N0 M0
IF TNM=200
SET SG="2A"
QUIT
+11 ;IIB T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+12 ; T3 N0 M0
IF TNM=300
SET SG="2B"
QUIT
+13 ;IIIA T0 N2 M0
IF TNM="020"
SET SG="3A"
QUIT
+14 ; T1 N2 M0
IF TNM=120
SET SG="3A"
QUIT
+15 ; T2 N2 M0
IF TNM=220
SET SG="3A"
QUIT
+16 ; T3 N1 M0
IF TNM=310
SET SG="3A"
QUIT
+17 ; T3 N2 M0
IF TNM=320
SET SG="3A"
QUIT
+18 ;IIIB T4 N0 M0
IF TNM=400
SET SG="3B"
QUIT
+19 ; T4 N1 M0
IF TNM=410
SET SG="3B"
QUIT
+20 ; T4 N2 M0
IF TNM=420
SET SG="3B"
QUIT
+21 ;IIIC Any T N3 M0
IF $EXTRACT(N,1)=3
IF M=0
SET SG="3C"
QUIT
+22 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+23 ;
CLEANUP ;Cleanup
+1 KILL D0,HT,M,N,ONCOED,STGIND,T