ONCSG2 ;Hines OIFO/GWB - Automatic Staging Tables ;07/26/11
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
;THORAX
;
LUN34 ;Lung - 3rd and 4th editions
S SG=99
I M=1 S SG=4
E I M=0 D
.I T=4 S SG="3B"
.E I N=3 S SG="3B"
.E I N=2 S SG=$S(T=1:"3A",T=2:"3A",T=3:"3A",1:99)
.E I N=1 S SG=$S(T=1:2,T=2:2,T=3:"3A",1:99)
.E I N=0 S SG=$S(T="X":"OC",T="IS":0,T=1:1,T=2:1,T=3:"3A",1:99)
Q
;
LUN56 ;Lung - 5th and 6th editions
S TNM=T_N_M D K TNM Q
.I TNM="X00" S SG="OC" Q ;Occult Tx N0 M0
.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=110 S SG="2A" Q ;IIA T1 N1 M0
.I TNM=210 S SG="2B" Q ;IIB T2 N1 M0
.I TNM=300 S SG="2B" Q ; T3 N0 M0
.I TNM=120 S SG="3A" Q ;IIIA 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 N=3,M=0 S SG="3B" Q ;IIIB Any T N3 M0
.I T=4,M=0 S SG="3B" Q ; T4 Any N M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
;
LUN7 ;Lung - 7th editions
S TNM=T_N_M D K TNM Q
.I TNM="X00" S SG="OC" Q ;Occult Tx N0 M0
.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="1A" Q ; T1b N0 M0
.I TNM="2A00" S SG="1B" Q ;IB T2a N0 M0
.I TNM="2B00" S SG="2A" Q ;IIA T2a N0 M0
.I TNM="1A10" S SG="2A" Q ; T1a N1 M0
.I TNM="1B10" S SG="2A" Q ; T1b N1 M0
.I TNM="2A10" S SG="2A" Q ; T2a N1 M0
.I TNM="2B10" S SG="2B" Q ;IIB T2b N1 M0
.I TNM=300 S SG="2B" Q ; T3 N0 M0
.I TNM="1A20" S SG="3A" Q ;IIIA T1a N2 M0
.I TNM="1B20" S SG="3A" Q ; T1b N2 M0
.I TNM="2A20" S SG="3A" Q ; T2a N2 M0
.I TNM="2B20" S SG="3A" Q ; T2b 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="3A" Q ; T4 N0 M0
.I TNM=410 S SG="3A" Q ; T4 N1 M0
.I TNM="1A30" S SG="3B" Q ;IIIB T1a N3 M0
.I TNM="1B30" S SG="3B" Q ; T1b N3 M0
.I TNM="2A30" S SG="3B" Q ; T2a N3 M0
.I TNM="2B30" S SG="3B" Q ; T2b N3 M0
.I TNM=330 S SG="3B" Q ; T3 N3 M0
.I TNM=420 S SG="3B" Q ; T4 N2 M0
.I TNM=430 S SG="3B" Q ; T4 N3 M0
.I M=1 S SG=4 Q ;IV Any T Any N M1
.I M="1A" S SG=4 Q ; Any T Any N M1a
.I M="1B" S SG=4 Q ; Any T Any N M1b
;
PM45 ;Pleural Mesothelioma - 4th and 5th editions
I M S SG=4
E I T[4,M[0 S SG=4
E I N[3,M[0 S SG=4
E I (T[1)!(T[2),N[0,M[0 S SG=1
E I (T[1)!(T[2),N[1,M[0 S SG=2
E I (T[1)!(T[2),N[2,M[0 S SG=3
E I T[3,(N[0)!(N[1)!(N[2),M[0 S SG=3
E S SG=99
Q
;
PM6 ;Pleural Mesothelioma - 6th and 7th edition
S TNM=T_N_M D K TNM Q
.I TNM=100 S SG=1 Q ;I T1 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=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=120 S SG=3 Q ; T1 N2 M0
.I TNM=220 S SG=3 Q ; T2 N2 M0
.I TNM=300 S SG=3 Q ; T3 N0 M0
.I TNM=310 S SG=3 Q ; T3 N1 M0
.I TNM=320 S SG=3 Q ; T3 N2 M0
.I T=4,M=0 S SG=4 Q ;IV T4 Any N M0
.I N=3,M=0 S SG=4 Q ; Any T N3 M0
.I M=1 S SG=4 Q ; Any T Any N M1
;
;MUSCULOSKELETAL SITES
;
BONE345 ;Bone - 3rd, 4th and 5th editions
K SG
I M=1 S SG="4B"
E I M=0 D
.I N=1 S SG="4A"
.E I N=0 D BONLG
I '$D(SG) S SG=99
Q
;
BONLG ;Bone - 3rd, 4th and 5th editions (continued)
I (G=1)!(G=2) D
.I T=1 S SG="1A"
.E I T=2 S SG="1B"
E I (G=3)!(G=4) D
.I T=1 S SG="2A"
.E I T=2 S SG="2B"
Q
;
BONE6 ;Bone - 6th edition
S TNM=T_N_M D K TNM Q
.I ((G=1)!(G=2))&(TNM=100) S SG="1A" Q ;IA T1 N0 M0 G1,2
.I ((G=1)!(G=2))&(TNM=200) S SG="1B" Q ;IB T2 N0 M0 G1,2
.I ((G=3)!(G=4))&(TNM=100) S SG="2A" Q ;IIA T1 N0 M0 G3,4
.I ((G=3)!(G=4))&(TNM=200) S SG="2B" Q ;IIB T2 N0 M0 G3,4
.I TNM=300 S SG=3 Q ;III T3 N0 M0 Any G
.I N=0,M="1A" S SG="4A" Q ;IVA Any T N0 M1a Any G
.I N=1 S SG="4B" Q ;IVB Any T N1 Any M Any G
.I M="1B" S SG="4B" Q ; Any T Any N M1b Any G
;
BONE7 ;Bone - 7th edition
S TNM=T_N_M D K TNM Q
.I ((G=1)!(G=2))&(TNM=100) S SG="1A" Q ;IA T1 N0 M0 G1,2
.I ((G=1)!(G=2))&(TNM=200) S SG="1B" Q ;IB T2 N0 M0 G1,2
.I ((G=1)!(G=2))&(TNM=300) S SG="1B" Q ;IB T3 N0 M0 G1,2
.I ((G=3)!(G=4))&(TNM=100) S SG="2A" Q ;IIA T1 N0 M0 G3,4
.I ((G=3)!(G=4))&(TNM=200) S SG="2B" Q ;IIB T2 N0 M0 G3,4
.I ((G=3)!(G=4))&(TNM=300) S SG=3 Q ;III T3 N0 M0 G3,4
.I N=0,M="1A" S SG="4A" Q ;IVA Any T N0 M1a Any G
.I N=1 S SG="4B" Q ;IVB Any T N1 Any M Any G
.I M="1B" S SG="4B" Q ; Any T Any N M1b Any G
;
STS34 ;Soft Tissue Sarcoma - 3rd and 4th editions
I $E(M)=1 S SG="4B"
E I $E(M)=0 D
.I $E(N)=1 S SG="4A"
.E I $E(N)=0,(G=1)!(G=2)!(G=3)!(G=4),(T=1)!(T=2) S SG=$S(G=1:1,G=2:2,1:3)_$S(T=1:"A",1:"B")
I '$D(SG) S SG=99
Q
;
STS5 ;Soft Tissue Sarcoma - 5th edition
S TNM=T_N_M D K TNM Q
.I ((G=1)!(G=2))&(TNM="1A00") S SG="1A" Q ;IA G1-2 T1a N0 M0
.I ((G=1)!(G=2))&(TNM="1B00") S SG="1A" Q ; T1b N0 M0
.I ((G=1)!(G=2))&(TNM="2A00") S SG="1B" Q ;IB G1-2 T2a N0 M0
.I ((G=1)!(G=2))&(TNM="2B00") S SG="2A" Q ;IIA G1-2 T2b N0 M0
.I ((G=3)!(G=4))&(TNM="1A00") S SG="2B" Q ;IIB G3-4 T1a N0 M0
.I ((G=3)!(G=4))&(TNM="1B00") S SG="2B" Q ; T1b N0 M0
.I ((G=3)!(G=4))&(TNM="2A00") S SG="2C" Q ;IIC G3-4 T2a N0 M0
.I ((G=3)!(G=4))&(TNM="2B00") S SG=3 Q ;III G3-4 T2b N0 M0
.I N=1,M=0 S SG=4 Q ;IV Any G Any T N1 M0
.I N=0,M=1 S SG=4 Q ;IV Any G Any T N0 M1
.I N=1,M=1 S SG=4 Q ;IV Any G Any T N1 M1
;
STS6 ;Soft Tissue Sarcoma - 6th edition
S TNM=T_N_M D K TNM Q
.I ((G=1)!(G=2))&(TNM="1A00") S SG="1A" Q ;IA T1a N0 M0 G1-2
.I ((G=1)!(G=2))&(TNM="1AX0") S SG="1A" Q ; T1a NX M0 G1-2
.I ((G=1)!(G=2))&(TNM="1B00") S SG="1A" Q ; T1b N0 M0 G1-2
.I ((G=1)!(G=2))&(TNM="1BX0") S SG="1A" Q ; T1b NX M0 G1-2
.I ((G=1)!(G=2))&(TNM="2A00") S SG="1B" Q ;IB T2a N0 M0 G1-2
.I ((G=1)!(G=2))&(TNM="2AX0") S SG="1B" Q ; T2a NX M0 G1-2
.I ((G=1)!(G=2))&(TNM="2B00") S SG="1B" Q ; T2b N0 M0 G1-2
.I ((G=1)!(G=2))&(TNM="2BX0") S SG="1B" Q ; T2b NX M0 G1-2
.I ((G=3)!(G=4))&(TNM="1A00") S SG="2A" Q ;IIA T1a N0 M0 G3-4
.I ((G=3)!(G=4))&(TNM="1AX0") S SG="2A" Q ; T1a NX M0 G3-4
.I ((G=3)!(G=4))&(TNM="1B00") S SG="2A" Q ; T1b N0 M0 G3-4
.I ((G=3)!(G=4))&(TNM="1BX0") S SG="2A" Q ; T1b NX M0 G3-4
.I ((G=3)!(G=4))&(TNM="2A00") S SG="2B" Q ;IIB T2a N0 M0 G3-4
.I ((G=3)!(G=4))&(TNM="2AX0") S SG="2B" Q ; T2a NX M0 G3-4
.I ((G=3)!(G=4))&(TNM="2B00") S SG=3 Q ;III T2b N0 M0 G3-4
.I ((G=3)!(G=4))&(TNM="2BX0") S SG=3 Q ; T2b NX M0 G3-4
.I N=1,M=0 S SG=4 Q ;IV Any T N1 M0 Any G
.I N=0,M=1 S SG=4 Q ; Any T N0 M1 Any G
.I N=1,M=1 S SG=4 Q ; Any T N1 M1 Any G
;
STS7 ;Soft Tissue Sarcoma - 7th edition
S TNM=T_N_M D K TNM Q
.I ((G=1)!(G=9))&(TNM="1A00") S SG="1A" Q ;IA T1a N0 M0 G1,GX
.I ((G=1)!(G=9))&(TNM="1B00") S SG="1A" Q ; T1b N0 M0 G1,GX
.I ((G=1)!(G=9))&(TNM="2A00") S SG="1B" Q ;IB T2a N0 M0 G1,GX
.I ((G=1)!(G=9))&(TNM="2B00") S SG="1B" Q ; T2b N0 M0 G1,GX
.I ((G=2)!(G=3))&(TNM="1A00") S SG="2A" Q ;IIA T1a N0 M0 G2,3
.I ((G=2)!(G=3))&(TNM="1B00") S SG="2A" Q ; T1b N0 M0 G2,3
.I G=2,TNM="2A00" S SG="2B" Q ;IIB T2a N0 M0 G2
.I G=2,TNM="2B00" S SG="2B" Q ; T2b N0 M0 G2
.I G=3,TNM="2A00" S SG=3 Q ;III T2a N0 M0 G3
.I G=3,TNM="2B00" S SG=3 Q ; T2b N0 M0 G3
.I N=1,M=0 S SG=3 Q ; Any T N1 M0 Any G
.I M=1 S SG=4 Q ;IV Any T Any N M1 Any G
;
CLEANUP ;Cleanup
K G,M,N,T
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSG2 8886 printed Dec 13, 2024@02:28:22 Page 2
ONCSG2 ;Hines OIFO/GWB - Automatic Staging Tables ;07/26/11
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ;THORAX
+4 ;
LUN34 ;Lung - 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=4
SET SG="3B"
+5 IF '$TEST
IF N=3
SET SG="3B"
+6 IF '$TEST
IF N=2
SET SG=$SELECT(T=1:"3A",T=2:"3A",T=3:"3A",1:99)
+7 IF '$TEST
IF N=1
SET SG=$SELECT(T=1:2,T=2:2,T=3:"3A",1:99)
+8 IF '$TEST
IF N=0
SET SG=$SELECT(T="X":"OC",T="IS":0,T=1:1,T=2:1,T=3:"3A",1:99)
End DoDot:1
+9 QUIT
+10 ;
LUN56 ;Lung - 5th and 6th editions
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;Occult Tx N0 M0
IF TNM="X00"
SET SG="OC"
QUIT
+3 ;0 Tis N0 M0
IF TNM="IS00"
SET SG=0
QUIT
+4 ;IA T1 N0 M0
IF TNM=100
SET SG="1A"
QUIT
+5 ;IB T2 N0 M0
IF TNM=200
SET SG="1B"
QUIT
+6 ;IIA T1 N1 M0
IF TNM=110
SET SG="2A"
QUIT
+7 ;IIB T2 N1 M0
IF TNM=210
SET SG="2B"
QUIT
+8 ; T3 N0 M0
IF TNM=300
SET SG="2B"
QUIT
+9 ;IIIA T1 N2 M0
IF TNM=120
SET SG="3A"
QUIT
+10 ; T2 N2 M0
IF TNM=220
SET SG="3A"
QUIT
+11 ; T3 N1 M0
IF TNM=310
SET SG="3A"
QUIT
+12 ; T3 N2 M0
IF TNM=320
SET SG="3A"
QUIT
+13 ;IIIB Any T N3 M0
IF N=3
IF M=0
SET SG="3B"
QUIT
+14 ; T4 Any N M0
IF T=4
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 ;
LUN7 ;Lung - 7th editions
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;Occult Tx N0 M0
IF TNM="X00"
SET SG="OC"
QUIT
+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 ; T1b N0 M0
IF TNM="1B00"
SET SG="1A"
QUIT
+6 ;IB T2a N0 M0
IF TNM="2A00"
SET SG="1B"
QUIT
+7 ;IIA T2a N0 M0
IF TNM="2B00"
SET SG="2A"
QUIT
+8 ; T1a N1 M0
IF TNM="1A10"
SET SG="2A"
QUIT
+9 ; T1b N1 M0
IF TNM="1B10"
SET SG="2A"
QUIT
+10 ; T2a N1 M0
IF TNM="2A10"
SET SG="2A"
QUIT
+11 ;IIB T2b N1 M0
IF TNM="2B10"
SET SG="2B"
QUIT
+12 ; T3 N0 M0
IF TNM=300
SET SG="2B"
QUIT
+13 ;IIIA T1a N2 M0
IF TNM="1A20"
SET SG="3A"
QUIT
+14 ; T1b N2 M0
IF TNM="1B20"
SET SG="3A"
QUIT
+15 ; T2a N2 M0
IF TNM="2A20"
SET SG="3A"
QUIT
+16 ; T2b N2 M0
IF TNM="2B20"
SET SG="3A"
QUIT
+17 ; T3 N1 M0
IF TNM=310
SET SG="3A"
QUIT
+18 ; T3 N2 M0
IF TNM=320
SET SG="3A"
QUIT
+19 ; T4 N0 M0
IF TNM=400
SET SG="3A"
QUIT
+20 ; T4 N1 M0
IF TNM=410
SET SG="3A"
QUIT
+21 ;IIIB T1a N3 M0
IF TNM="1A30"
SET SG="3B"
QUIT
+22 ; T1b N3 M0
IF TNM="1B30"
SET SG="3B"
QUIT
+23 ; T2a N3 M0
IF TNM="2A30"
SET SG="3B"
QUIT
+24 ; T2b N3 M0
IF TNM="2B30"
SET SG="3B"
QUIT
+25 ; T3 N3 M0
IF TNM=330
SET SG="3B"
QUIT
+26 ; T4 N2 M0
IF TNM=420
SET SG="3B"
QUIT
+27 ; T4 N3 M0
IF TNM=430
SET SG="3B"
QUIT
+28 ;IV Any T Any N M1
IF M=1
SET SG=4
QUIT
+29 ; Any T Any N M1a
IF M="1A"
SET SG=4
QUIT
+30 ; Any T Any N M1b
IF M="1B"
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+31 ;
PM45 ;Pleural Mesothelioma - 4th and 5th editions
+1 IF M
SET SG=4
+2 IF '$TEST
IF T[4
IF M[0
SET SG=4
+3 IF '$TEST
IF N[3
IF M[0
SET SG=4
+4 IF '$TEST
IF (T[1)!(T[2)
IF N[0
IF M[0
SET SG=1
+5 IF '$TEST
IF (T[1)!(T[2)
IF N[1
IF M[0
SET SG=2
+6 IF '$TEST
IF (T[1)!(T[2)
IF N[2
IF M[0
SET SG=3
+7 IF '$TEST
IF T[3
IF (N[0)!(N[1)!(N[2)
IF M[0
SET SG=3
+8 IF '$TEST
SET SG=99
+9 QUIT
+10 ;
PM6 ;Pleural Mesothelioma - 6th and 7th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;I T1 N0 M0
IF TNM=100
SET SG=1
QUIT
+3 ;IA T1a N0 M0
IF TNM="1A00"
SET SG="1A"
QUIT
+4 ;IB T1b N0 M0
IF TNM="1B00"
SET SG="1B"
QUIT
+5 ;II T2 N0 M0
IF TNM=200
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 ; T1 N2 M0
IF TNM=120
SET SG=3
QUIT
+9 ; T2 N2 M0
IF TNM=220
SET SG=3
QUIT
+10 ; T3 N0 M0
IF TNM=300
SET SG=3
QUIT
+11 ; T3 N1 M0
IF TNM=310
SET SG=3
QUIT
+12 ; T3 N2 M0
IF TNM=320
SET SG=3
QUIT
+13 ;IV T4 Any N M0
IF T=4
IF M=0
SET SG=4
QUIT
+14 ; Any T N3 M0
IF N=3
IF M=0
SET SG=4
QUIT
+15 ; Any T Any N M1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+16 ;
+17 ;MUSCULOSKELETAL SITES
+18 ;
BONE345 ;Bone - 3rd, 4th and 5th editions
+1 KILL SG
+2 IF M=1
SET SG="4B"
+3 IF '$TEST
IF M=0
Begin DoDot:1
+4 IF N=1
SET SG="4A"
+5 IF '$TEST
IF N=0
DO BONLG
End DoDot:1
+6 IF '$DATA(SG)
SET SG=99
+7 QUIT
+8 ;
BONLG ;Bone - 3rd, 4th and 5th editions (continued)
+1 IF (G=1)!(G=2)
Begin DoDot:1
+2 IF T=1
SET SG="1A"
+3 IF '$TEST
IF T=2
SET SG="1B"
End DoDot:1
+4 IF '$TEST
IF (G=3)!(G=4)
Begin DoDot:1
+5 IF T=1
SET SG="2A"
+6 IF '$TEST
IF T=2
SET SG="2B"
End DoDot:1
+7 QUIT
+8 ;
BONE6 ;Bone - 6th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;IA T1 N0 M0 G1,2
IF ((G=1)!(G=2))&(TNM=100)
SET SG="1A"
QUIT
+3 ;IB T2 N0 M0 G1,2
IF ((G=1)!(G=2))&(TNM=200)
SET SG="1B"
QUIT
+4 ;IIA T1 N0 M0 G3,4
IF ((G=3)!(G=4))&(TNM=100)
SET SG="2A"
QUIT
+5 ;IIB T2 N0 M0 G3,4
IF ((G=3)!(G=4))&(TNM=200)
SET SG="2B"
QUIT
+6 ;III T3 N0 M0 Any G
IF TNM=300
SET SG=3
QUIT
+7 ;IVA Any T N0 M1a Any G
IF N=0
IF M="1A"
SET SG="4A"
QUIT
+8 ;IVB Any T N1 Any M Any G
IF N=1
SET SG="4B"
QUIT
+9 ; Any T Any N M1b Any G
IF M="1B"
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+10 ;
BONE7 ;Bone - 7th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;IA T1 N0 M0 G1,2
IF ((G=1)!(G=2))&(TNM=100)
SET SG="1A"
QUIT
+3 ;IB T2 N0 M0 G1,2
IF ((G=1)!(G=2))&(TNM=200)
SET SG="1B"
QUIT
+4 ;IB T3 N0 M0 G1,2
IF ((G=1)!(G=2))&(TNM=300)
SET SG="1B"
QUIT
+5 ;IIA T1 N0 M0 G3,4
IF ((G=3)!(G=4))&(TNM=100)
SET SG="2A"
QUIT
+6 ;IIB T2 N0 M0 G3,4
IF ((G=3)!(G=4))&(TNM=200)
SET SG="2B"
QUIT
+7 ;III T3 N0 M0 G3,4
IF ((G=3)!(G=4))&(TNM=300)
SET SG=3
QUIT
+8 ;IVA Any T N0 M1a Any G
IF N=0
IF M="1A"
SET SG="4A"
QUIT
+9 ;IVB Any T N1 Any M Any G
IF N=1
SET SG="4B"
QUIT
+10 ; Any T Any N M1b Any G
IF M="1B"
SET SG="4B"
QUIT
End DoDot:1
KILL TNM
QUIT
+11 ;
STS34 ;Soft Tissue Sarcoma - 3rd and 4th editions
+1 IF $EXTRACT(M)=1
SET SG="4B"
+2 IF '$TEST
IF $EXTRACT(M)=0
Begin DoDot:1
+3 IF $EXTRACT(N)=1
SET SG="4A"
+4 IF '$TEST
IF $EXTRACT(N)=0
IF (G=1)!(G=2)!(G=3)!(G=4)
IF (T=1)!(T=2)
SET SG=$SELECT(G=1:1,G=2:2,1:3)_$SELECT(T=1:"A",1:"B")
End DoDot:1
+5 IF '$DATA(SG)
SET SG=99
+6 QUIT
+7 ;
STS5 ;Soft Tissue Sarcoma - 5th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;IA G1-2 T1a N0 M0
IF ((G=1)!(G=2))&(TNM="1A00")
SET SG="1A"
QUIT
+3 ; T1b N0 M0
IF ((G=1)!(G=2))&(TNM="1B00")
SET SG="1A"
QUIT
+4 ;IB G1-2 T2a N0 M0
IF ((G=1)!(G=2))&(TNM="2A00")
SET SG="1B"
QUIT
+5 ;IIA G1-2 T2b N0 M0
IF ((G=1)!(G=2))&(TNM="2B00")
SET SG="2A"
QUIT
+6 ;IIB G3-4 T1a N0 M0
IF ((G=3)!(G=4))&(TNM="1A00")
SET SG="2B"
QUIT
+7 ; T1b N0 M0
IF ((G=3)!(G=4))&(TNM="1B00")
SET SG="2B"
QUIT
+8 ;IIC G3-4 T2a N0 M0
IF ((G=3)!(G=4))&(TNM="2A00")
SET SG="2C"
QUIT
+9 ;III G3-4 T2b N0 M0
IF ((G=3)!(G=4))&(TNM="2B00")
SET SG=3
QUIT
+10 ;IV Any G Any T N1 M0
IF N=1
IF M=0
SET SG=4
QUIT
+11 ;IV Any G Any T N0 M1
IF N=0
IF M=1
SET SG=4
QUIT
+12 ;IV Any G Any T N1 M1
IF N=1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+13 ;
STS6 ;Soft Tissue Sarcoma - 6th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;IA T1a N0 M0 G1-2
IF ((G=1)!(G=2))&(TNM="1A00")
SET SG="1A"
QUIT
+3 ; T1a NX M0 G1-2
IF ((G=1)!(G=2))&(TNM="1AX0")
SET SG="1A"
QUIT
+4 ; T1b N0 M0 G1-2
IF ((G=1)!(G=2))&(TNM="1B00")
SET SG="1A"
QUIT
+5 ; T1b NX M0 G1-2
IF ((G=1)!(G=2))&(TNM="1BX0")
SET SG="1A"
QUIT
+6 ;IB T2a N0 M0 G1-2
IF ((G=1)!(G=2))&(TNM="2A00")
SET SG="1B"
QUIT
+7 ; T2a NX M0 G1-2
IF ((G=1)!(G=2))&(TNM="2AX0")
SET SG="1B"
QUIT
+8 ; T2b N0 M0 G1-2
IF ((G=1)!(G=2))&(TNM="2B00")
SET SG="1B"
QUIT
+9 ; T2b NX M0 G1-2
IF ((G=1)!(G=2))&(TNM="2BX0")
SET SG="1B"
QUIT
+10 ;IIA T1a N0 M0 G3-4
IF ((G=3)!(G=4))&(TNM="1A00")
SET SG="2A"
QUIT
+11 ; T1a NX M0 G3-4
IF ((G=3)!(G=4))&(TNM="1AX0")
SET SG="2A"
QUIT
+12 ; T1b N0 M0 G3-4
IF ((G=3)!(G=4))&(TNM="1B00")
SET SG="2A"
QUIT
+13 ; T1b NX M0 G3-4
IF ((G=3)!(G=4))&(TNM="1BX0")
SET SG="2A"
QUIT
+14 ;IIB T2a N0 M0 G3-4
IF ((G=3)!(G=4))&(TNM="2A00")
SET SG="2B"
QUIT
+15 ; T2a NX M0 G3-4
IF ((G=3)!(G=4))&(TNM="2AX0")
SET SG="2B"
QUIT
+16 ;III T2b N0 M0 G3-4
IF ((G=3)!(G=4))&(TNM="2B00")
SET SG=3
QUIT
+17 ; T2b NX M0 G3-4
IF ((G=3)!(G=4))&(TNM="2BX0")
SET SG=3
QUIT
+18 ;IV Any T N1 M0 Any G
IF N=1
IF M=0
SET SG=4
QUIT
+19 ; Any T N0 M1 Any G
IF N=0
IF M=1
SET SG=4
QUIT
+20 ; Any T N1 M1 Any G
IF N=1
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+21 ;
STS7 ;Soft Tissue Sarcoma - 7th edition
+1 SET TNM=T_N_M
Begin DoDot:1
+2 ;IA T1a N0 M0 G1,GX
IF ((G=1)!(G=9))&(TNM="1A00")
SET SG="1A"
QUIT
+3 ; T1b N0 M0 G1,GX
IF ((G=1)!(G=9))&(TNM="1B00")
SET SG="1A"
QUIT
+4 ;IB T2a N0 M0 G1,GX
IF ((G=1)!(G=9))&(TNM="2A00")
SET SG="1B"
QUIT
+5 ; T2b N0 M0 G1,GX
IF ((G=1)!(G=9))&(TNM="2B00")
SET SG="1B"
QUIT
+6 ;IIA T1a N0 M0 G2,3
IF ((G=2)!(G=3))&(TNM="1A00")
SET SG="2A"
QUIT
+7 ; T1b N0 M0 G2,3
IF ((G=2)!(G=3))&(TNM="1B00")
SET SG="2A"
QUIT
+8 ;IIB T2a N0 M0 G2
IF G=2
IF TNM="2A00"
SET SG="2B"
QUIT
+9 ; T2b N0 M0 G2
IF G=2
IF TNM="2B00"
SET SG="2B"
QUIT
+10 ;III T2a N0 M0 G3
IF G=3
IF TNM="2A00"
SET SG=3
QUIT
+11 ; T2b N0 M0 G3
IF G=3
IF TNM="2B00"
SET SG=3
QUIT
+12 ; Any T N1 M0 Any G
IF N=1
IF M=0
SET SG=3
QUIT
+13 ;IV Any T Any N M1 Any G
IF M=1
SET SG=4
QUIT
End DoDot:1
KILL TNM
QUIT
+14 ;
CLEANUP ;Cleanup
+1 KILL G,M,N,T