ONCSG1A ;Hines OIFO/GWB - Automatic Staging Tables ;06/23/10
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;DIGESTIVE SYSTEM (continued)
;
LIV34 ;Liver - 3rd and 4th editions
S TNM=T_N_M D K TNM Q
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM=110 S SG=3 Q ;III T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=300 S SG=3 Q ; T3 N0 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I T=4,M=0 S SG="4A" Q ;IVA T4 Any N M0
.I M=1 S SG="4B" Q ;IVB Any T Any N M1
;
LIV5 ;Liver - 5th edition
S TNM=T_N_M D K TNM Q
.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="3A" Q ;IIIA T3 N0 M0
.I TNM=110 S SG="3B" Q ;IIIB T1 N1 M0
.I TNM=210 S SG="3B" Q ; T2 N1 M0
.I TNM=310 S SG="3B" Q ; T3 N1 M0
.I T=4,M=0 S SG="4A" Q ;IVA T4 Any N M0
.I M=1 S SG="4B" Q ;IVB Any T Any N M1
;
LIV6 ;Liver - 6th edition
S TNM=T_N_M D K TNM Q
.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="3A" Q ;IIIA T3 N0 M0
.I TNM=400 S SG="3B" Q ;IIIB T4 N0 M0
.I N=1,M=0 S SG="3C" Q ;IIIC Any T N1 M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
LIV7 ;Liver and Intrahepatic Bile Ducts - 7th edition
I TX=67221 G IBD
;Liver (C22.0)
S TNM=T_N_M D K TNM Q
.I TNM=100 S SG=1 Q ;I T1 N0 M0
.I TNM=200 S SG=2 Q ;II T2 N0 M0
.I TNM="3A00" S SG="3A" Q ;IIIA T3a N0 M0
.I TNM="3B00" S SG="3B" Q ;IIIB T3b N0 M0
.I TNM=400 S SG="3C" Q ;IIIC T4 N0 M0
.I N=1,M=0 S SG="4A" ;IVA Any T N1 M0
.I M=1 S SG="4B" Q ;IVB Any T Any N M1
;
IBD ;Intrahepatic Bile Ducts (C22.1)
I T="IS" S TNM=T_N_M
E S TNM=$E(T,1)_N_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=400 S SG="4A" Q ;IVA T4 N0 M0
.I N=1,M=0 S SG="4A" ; Any T N1 M0
.I M=1 S SG="4B" Q ;IVB Any T Any N M1
;
GB3 ;Gallbladder - 3rd edition
I T="IS" S TNM=T_$E(N,1)_M
E S TNM=$E(T,1)_$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=110 S SG=3 Q ;III T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I T=3,M=0 S SG=3 Q ; T3 Any N M0
.I T=4,M=0 S SG=4 Q ;IV T4 Any N M0
.I M=1 S SG=4 Q ; Any T Any N M1
;
GB45 ;Gallbladder - 4th and 5th editions
I T="IS" S TNM=T_N_M
E S TNM=$E(T,1)_N_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=110 S SG=3 Q ;III T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=300 S SG=3 Q ; T3 N0 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I TNM=400 S SG="4A" Q ;IVA T4 N0 M0
.I TNM=410 S SG="4A" Q ; T4 N1 M0
.I N=2,M=0 S SG="4B" Q ;IVB Any T N2 M0
.I M=1 S SG="4B" Q ; Any T Any N M1
;
GB6 ;Gallbladder - 6th edition
I T="IS" S TNM=T_N_M
E S TNM=$E(T,1)_N_M
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 TNM=200 S SG="1B" Q ;IB T2 N0 M0
.I TNM=300 S SG="2A" Q ;IIA T3 N0 M0
.I TNM=110 S SG="2B" Q ;IIB T1 N1 M0
.I TNM=210 S SG="2B" Q ; T2 N1 M0
.I TNM=310 S SG="2B" Q ; T3 N1 M0
.I T=4,M=0 S SG=3 Q ;III T4 Any N M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
GB7 ;Gallbladder - 7th edition
I T="IS" S TNM=T_N_M
E S TNM=$E(T,1)_N_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="3A" Q ;IIIA T3 N0 M0
.I TNM=110 S SG="3B" Q ;IIIB T1 N1 M0
.I TNM=210 S SG="3B" Q ; T2 N1 M0
.I TNM=310 S SG="3B" Q ; T3 N1 M0
.I TNM=400 S SG="4A" Q ;IVA T4 N0 M0
.I TNM=410 S SG="4A" Q ; T4 N1 M0
.I N=2,M=0 S SG="4B" ;IVB Any T N2 M0
.I M=1 S SG="4B" Q ; Any T Any N M1
;
EBD3 ;Extrahepatic Bile Ducts - 3rd edition
S SG=$S(M:"4B",T=3:"4A",+N=1:3,T=2:2,+T=1:1,T="IS":0,1:"E")
Q
;
EBD45 ;Extrahepatic Bile Ducts - 4th and 5th editions
S SG=$S(M:"4B",T=3:"4A",N&T:3,T=2:2,+T=1:1,T="IS":0,1:"E")
Q
;
EBD6 ;Extrahepatic Bile Ducts - 6th edition
S TNM=T_N_M 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 TNM=200 S SG="1B" Q ;IB T2 N0 M0
.I TNM=300 S SG="2A" Q ;IIA T3 N0 M0
.I TNM=110 S SG="2B" Q ;IIB T1 N1 M0
.I TNM=210 S SG="2B" Q ; T2 N1 M0
.I TNM=310 S SG="2B" Q ; T3 N1 M0
.I T=4,M=0 S SG=3 Q ;III T4 Any N M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
PBD ;Perihilar Bile Ducts - 7th edition
S TNM=T_N_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="2A00" S SG=2 Q ;II T2a N0 M0
.I TNM="2B00" S SG=2 Q ; T2b N0 M0
.I TNM=300 S SG="3A" Q ;IIIA T3 N0 M0
.I TNM=110 S SG="3B" Q ;IIIB T1 N1 M0
.I TNM="2A10" S SG="3B" Q ; T2a N1 M0
.I TNM="2B10" S SG="3B" Q ; T2b N1 M0
.I TNM=310 S SG="3B" Q ; T3 N1 M0
.I TNM=400 S SG="4A" Q ;IVA T4 N0 M0
.I TNM=410 S SG="4A" Q ; T4 N1 M0
.I N=2,M=0 S SG="4B" Q ;IVB Any T N2 M0
.I M=1 S SG="4B" Q ; Any T Any N M1
;
DBD ;Distal Bile Duct - 7th edition
S TNM=T_N_M 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 TNM=200 S SG="1B" Q ;IB T2 N0 M0
.I TNM=300 S SG="2A" Q ;IIA T3 N0 M0
.I TNM=110 S SG="2B" Q ;IIB T1 N1 M0
.I TNM=210 S SG="2B" Q ; T2 N1 M0
.I TNM=310 S SG="2B" Q ; T3 N1 M0
.I T=4,M=0 S SG=4 Q ;III T4 Any N M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
AV345 ;Ampulla of Vater - 3rd, 4th and 5th editions
K SG
I M=1 S SG=4
E I M=0 D
.I T="IS",N=0 S SG=0
.E I T=1,N=0 S SG=1
.E I (T=2)!(T=3),N=0 S SG=2
.E I (T=1)!(T=2)!(T=3),N=1 S SG=3
.E I T=4 S SG=4
I '$D(SG) S SG=99
Q
;
AV6 ;Ampulla of Vater - 6th and 7th edition
S TNM=T_N_M 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 TNM=200 S SG="1B" Q ;IB T2 N0 M0
.I TNM=300 S SG="2A" Q ;IIA T3 N0 M0
.I TNM=110 S SG="2B" Q ;IIB T1 N1 M0
.I TNM=210 S SG="2B" Q ; T2 N1 M0
.I TNM=310 S SG="2B" Q ; T3 N1 M0
.I T=4,M=0 S SG=3 Q ;III T4 Any N M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
EXO34 ;Exocrine Pancreas - 3rd and 4th editions
S SG=99
I M=1 S SG=4
E I M=0 D
.I (T[1)!(T=2),N=0 S SG=1
.E I T=3,N=0 S SG=2
.E I N=1 S SG=3
Q
;
EXO5 ;Exocrine Pancreas - 5th edition
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=1 Q ; T2 N0 M0
.I TNM=300 S SG=2 Q ;II T3 N0 M0
.I TNM=110 S SG=3 Q ;III T1 N1 M0
.I TNM=210 S SG=3 Q ; T2 N1 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I T=4,M=0 S SG="4A" Q ;IVA T4 Any N M0
.I M=1 S SG="4B" Q ;IVB Any T Any N M1
;
EXO6 ;Exocrine Pancreas - 6th and 7th edition
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="1A" Q ;IA T1 N0 M0
.I TNM=200 S SG="1B" Q ;IB T2 N0 M0
.I TNM=300 S SG="2A" Q ;IIA T3 N0 M0
.I TNM=110 S SG="2B" Q ;IIB T1 N1 M0
.I TNM=210 S SG="2B" Q ; T2 N1 M0
.I TNM=310 S SG="2B" Q ; T3 N1 M0
.I T=4,M=0 S SG=3 Q ;III T4 Any N M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
CLEANUP ;Cleanup
K M,N,T,TX
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSG1A 8723 printed Dec 13, 2024@02:28:21 Page 2
ONCSG1A ;Hines OIFO/GWB - Automatic Staging Tables ;06/23/10
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;DIGESTIVE SYSTEM (continued)
+4 ;
LIV34 ;Liver - 3rd and 4th editions
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+3 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+4 ;III T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+5 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+6 ; T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+7 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+8 ;IVA T4 Any N M0
IF T=4
IF M=0
SET SG="4A"
QUIT
+9 ;IVB Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+10 ;
LIV5 ;Liver - 5th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+3 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+4 ;IIIA T3 N0 M0
IF TNM=300
SET SG="3A"
QUIT
+5 ;IIIB T1 N1 M0
IF TNM=110
SET SG="3B"
QUIT
+6 ; T2 N1 M0
IF TNM=210
SET SG="3B"
QUIT
+7 ; T3 N1 M0
IF TNM=310
SET SG="3B"
QUIT
+8 ;IVA T4 Any N M0
IF T=4
IF M=0
SET SG="4A"
QUIT
+9 ;IVB Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+10 ;
LIV6 ;Liver - 6th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+3 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+4 ;IIIA T3 N0 M0
IF TNM=300
SET SG="3A"
QUIT
+5 ;IIIB T4 N0 M0
IF TNM=400
SET SG="3B"
QUIT
+6 ;IIIC Any T N1 M0
IF N=1
IF M=0
SET SG="3C"
QUIT
+7 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+8 ;
LIV7 ;Liver and Intrahepatic Bile Ducts - 7th edition
+1 IF TX=67221
GOTO IBD
+2 ;Liver (C22.0)
+3 SET TNM=T_N_M
Begin DoDot:1
+4 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+5 ;II T2 N0 M0
IF TNM=200
SET SG=2
QUIT
+6 ;IIIA T3a N0 M0
IF TNM="3A00"
SET SG="3A"
QUIT
+7 ;IIIB T3b N0 M0
IF TNM="3B00"
SET SG="3B"
QUIT
+8 ;IIIC T4 N0 M0
IF TNM=400
SET SG="3C"
QUIT
+9 ;IVA Any T N1 M0
IF N=1
IF M=0
SET SG="4A"
+10 ;IVB Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
IBD ;Intrahepatic Bile Ducts (C22.1)
+1 IF T="IS"
SET TNM=T_N_M
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_N_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 ;IVA T4 N0 M0
IF TNM=400
SET SG="4A"
QUIT
+9 ; Any T N1 M0
IF N=1
IF M=0
SET SG="4A"
+10 ;IVB Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
GB3 ;Gallbladder - 3rd edition
+1 IF T="IS"
SET TNM=T_$EXTRACT(N,1)_M
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_$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 T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+8 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+9 ; T3 Any N M0
IF T=3
IF M=0
SET SG=3
QUIT
+10 ;IV T4 Any N M0
IF T=4
IF M=0
SET SG=4
QUIT
+11 ; Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+12 ;
GB45 ;Gallbladder - 4th and 5th editions
+1 IF T="IS"
SET TNM=T_N_M
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_N_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 T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+8 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+9 ; T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+10 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+11 ;IVA T4 N0 M0
IF TNM=400
SET SG="4A"
QUIT
+12 ; T4 N1 M0
IF TNM=410
SET SG="4A"
QUIT
+13 ;IVB Any T N2 M0
IF N=2
IF M=0
SET SG="4B"
QUIT
+14 ; Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+15 ;
GB6 ;Gallbladder - 6th edition
+1 IF T="IS"
SET TNM=T_N_M
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_N_M
+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 T2 N0 M0
IF TNM=200
SET SG="1B"
QUIT
+7 ;IIA T3 N0 M0
IF TNM=300
SET SG="2A"
QUIT
+8 ;IIB T1 N1 M0
IF TNM=110
SET SG="2B"
QUIT
+9 ; T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+10 ; T3 N1 M0
IF TNM=310
SET SG="2B"
QUIT
+11 ;III T4 Any N M0
IF T=4
IF M=0
SET SG=3
QUIT
+12 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+13 ;
GB7 ;Gallbladder - 7th edition
+1 IF T="IS"
SET TNM=T_N_M
+2 IF '$TEST
SET TNM=$EXTRACT(T,1)_N_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 ;IIIA T3 N0 M0
IF TNM=300
SET SG="3A"
QUIT
+8 ;IIIB T1 N1 M0
IF TNM=110
SET SG="3B"
QUIT
+9 ; T2 N1 M0
IF TNM=210
SET SG="3B"
QUIT
+10 ; T3 N1 M0
IF TNM=310
SET SG="3B"
QUIT
+11 ;IVA T4 N0 M0
IF TNM=400
SET SG="4A"
QUIT
+12 ; T4 N1 M0
IF TNM=410
SET SG="4A"
QUIT
+13 ;IVB Any T N2 M0
IF N=2
IF M=0
SET SG="4B"
+14 ; Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+15 ;
EBD3 ;Extrahepatic Bile Ducts - 3rd edition
+1 SET SG=$SELECT(M:"4B",T=3:"4A",+N=1:3,T=2:2,+T=1:1,T="IS":0,1:"E")
+2 QUIT
+3 ;
EBD45 ;Extrahepatic Bile Ducts - 4th and 5th editions
+1 SET SG=$SELECT(M:"4B",T=3:"4A",N&T:3,T=2:2,+T=1:1,T="IS":0,1:"E")
+2 QUIT
+3 ;
EBD6 ;Extrahepatic Bile Ducts - 6th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;IA T1 N0 M0
IF TNM=100
SET SG="1A"
QUIT
+4 ;IB T2 N0 M0
IF TNM=200
SET SG="1B"
QUIT
+5 ;IIA T3 N0 M0
IF TNM=300
SET SG="2A"
QUIT
+6 ;IIB T1 N1 M0
IF TNM=110
SET SG="2B"
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG="2B"
QUIT
+9 ;III T4 Any N M0
IF T=4
IF M=0
SET SG=3
QUIT
+10 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
PBD ;Perihilar Bile Ducts - 7th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+4 ;II T2a N0 M0
IF TNM="2A00"
SET SG=2
QUIT
+5 ; T2b N0 M0
IF TNM="2B00"
SET SG=2
QUIT
+6 ;IIIA T3 N0 M0
IF TNM=300
SET SG="3A"
QUIT
+7 ;IIIB T1 N1 M0
IF TNM=110
SET SG="3B"
QUIT
+8 ; T2a N1 M0
IF TNM="2A10"
SET SG="3B"
QUIT
+9 ; T2b N1 M0
IF TNM="2B10"
SET SG="3B"
QUIT
+10 ; T3 N1 M0
IF TNM=310
SET SG="3B"
QUIT
+11 ;IVA T4 N0 M0
IF TNM=400
SET SG="4A"
QUIT
+12 ; T4 N1 M0
IF TNM=410
SET SG="4A"
QUIT
+13 ;IVB Any T N2 M0
IF N=2
IF M=0
SET SG="4B"
QUIT
+14 ; Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+15 ;
DBD ;Distal Bile Duct - 7th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;IA T1 N0 M0
IF TNM=100
SET SG="1A"
QUIT
+4 ;IB T2 N0 M0
IF TNM=200
SET SG="1B"
QUIT
+5 ;IIA T3 N0 M0
IF TNM=300
SET SG="2A"
QUIT
+6 ;IIB T1 N1 M0
IF TNM=110
SET SG="2B"
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG="2B"
QUIT
+9 ;III T4 Any N M0
IF T=4
IF M=0
SET SG=4
QUIT
+10 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
AV345 ;Ampulla of Vater - 3rd, 4th and 5th editions
+1 KILL SG
+2 IF M=1
SET SG=4
+3 IF '$TEST
IF M=0
Begin DoDot:1
+4 IF T="IS"
IF N=0
SET SG=0
+5 IF '$TEST
IF T=1
IF N=0
SET SG=1
+6 IF '$TEST
IF (T=2)!(T=3)
IF N=0
SET SG=2
+7 IF '$TEST
IF (T=1)!(T=2)!(T=3)
IF N=1
SET SG=3
+8 IF '$TEST
IF T=4
SET SG=4
End DoDot:1
+9 IF '$DATA(SG)
SET SG=99
+10 QUIT
+11 ;
AV6 ;Ampulla of Vater - 6th and 7th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;IA T1 N0 M0
IF TNM=100
SET SG="1A"
QUIT
+4 ;IB T2 N0 M0
IF TNM=200
SET SG="1B"
QUIT
+5 ;IIA T3 N0 M0
IF TNM=300
SET SG="2A"
QUIT
+6 ;IIB T1 N1 M0
IF TNM=110
SET SG="2B"
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG="2B"
QUIT
+9 ;III T4 Any N M0
IF T=4
IF M=0
SET SG=3
QUIT
+10 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
EXO34 ;Exocrine Pancreas - 3rd and 4th editions
+1 SET SG=99
+2 IF M=1
SET SG=4
+3 IF '$TEST
IF M=0
Begin DoDot:1
+4 IF (T[1)!(T=2)
IF N=0
SET SG=1
+5 IF '$TEST
IF T=3
IF N=0
SET SG=2
+6 IF '$TEST
IF N=1
SET SG=3
End DoDot:1
+7 QUIT
+8 ;
EXO5 ;Exocrine Pancreas - 5th edition
+1 SET TNM=T_$EXTRACT(N,1)_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+4 ; T2 N0 M0
IF TNM=200
SET SG=1
QUIT
+5 ;II T3 N0 M0
IF TNM=300
SET SG=2
QUIT
+6 ;III T1 N1 M0
IF TNM=110
SET SG=3
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG=3
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+9 ;IVA T4 Any N M0
IF T=4
IF M=0
SET SG="4A"
QUIT
+10 ;IVB Any T Any N M1
IF M=1
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
EXO6 ;Exocrine Pancreas - 6th and 7th edition
+1 SET TNM=T_$EXTRACT(N,1)_M
Begin DoDot:1
+2 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+3 ;IA T1 N0 M0
IF TNM=100
SET SG="1A"
QUIT
+4 ;IB T2 N0 M0
IF TNM=200
SET SG="1B"
QUIT
+5 ;IIA T3 N0 M0
IF TNM=300
SET SG="2A"
QUIT
+6 ;IIB T1 N1 M0
IF TNM=110
SET SG="2B"
QUIT
+7 ; T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+8 ; T3 N1 M0
IF TNM=310
SET SG="2B"
QUIT
+9 ;III T4 Any N M0
IF T=4
IF M=0
SET SG=3
QUIT
+10 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
CLEANUP ;Cleanup
+1 KILL M,N,T,TX