ONCSCHMA ;HINES OIFO/RTK - Schema derivation and related code ;04/27/18
;;2.2;ONCOLOGY;**10,12,13,17,18**;Jul 31, 2013;Build 5
;
DER ;Derive the correct SCHEMA ID for the abstract based on Primary Site,
; Histology and possibly Schema Discriminators and Sex
; AND Store the SCHEMA ID in field #165.5,#3800
; TOPCOD should be set in Abstract
N ONCHIST,ONCTPCD,ONCSDIS1,ONCSDIS2,ONCSSEX,ONCT3,HST14
S ONCSCMA=0 ;initialize the schema first
S ONCHIST=$$HIST^ONCFUNC(D0)
I '$D(TOPCOD)!('$D(ONCHIST)) W !!," ** MISSING PRIMARY SITE AND/OR HISTOLOGY -- CANNOT DERIVE SCHEMA **",! Q
S ONCTPCD=$P(TOPCOD,".",1)_$P(TOPCOD,".",2) ;remove the "."
S HST14=$E(ONCHIST,1,4),HST5=$E(ONCHIST,5),ONCT3=$E(ONCTPCD,2,5)
S ONCSDIS1=$P($G(^ONCO(165.5,D0,"SSD4")),U,21) ; Schema Discriminator 1
S ONCSDIS2=$P($G(^ONCO(165.5,D0,"SSD4")),U,22) ; Schema Discriminator 2
S ONCSDIS3=$P($G(^ONCO(165.5,D0,"SSD4")),U,23) ; Schema Discriminator 3
S ONCPTPR=$P($G(^ONCO(165.5,D0,0)),U,2),ONCSSEX=$P($G(^ONCO(160,ONCPTPR,0)),U,8) I $G(ONCSSEX)="" W "CHECK PATIENT'S SEX FIELD IN PATIENT FILE" H 2
;
D SCMA
I ONCSCMA=0 D ^ONCSCHMB
I ONCSCMA=0 D ^ONCSCHMC
I ONCSCMA=0 D ^ONCSCHMD
I ONCSCMA=0 D ^ONCSCHME
;
I ONCSCMA=0 W !!," ** UNABLE TO DERIVE SCHEMA **",!!
I ONCSCMA'=0 S $P(^ONCO(165.5,D0,"SSD1"),U,1)=ONCSCMA
;
K ONCPTPR Q
;
;
SCMA ; go through until hit is found, else return ONCSCMA=0
;
;ADNEXA UTERINE OTHER: C571-C574 HIST 8000-8700,8720-8790,9700,9701
I "C571^C572^C573^C574"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791)) S ONCSCMA="00558"
;
;ADRENAL GLAND: C740,C741,C749 H8000-8671,8681-8683,8691,8720-8790,
; 9700,9701
I "C740^C741^C749"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8672))!((HST14>8680)&(HST14<8684))!((HST14>8719)&(HST14<8791))!(HST14=8691)!(HST14=9700)!(HST14=9701) S ONCSCMA="00760"
;
;AMPULLA OF VATER: C241 H8000-8149,8154,8157,8160-8231,8243-8248,8250-
; 8682,8690-8700,8720-8790,9700,9701
I ONCTPCD="C241" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00270"
;
;ANUS: C210-C212,C218 H8000-8700,9700,9701
; or C211-C212,C218 H8720-8790
I "C210^C211^C212^C218"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791)) D
..I DATEDX<3230000 S ONCSCMA="00210"
..I DATEDX>3221231 S ONCSCMA="09210"
;
;APPENDIX: C181 H8000-8149,8154,8157,8160-8231,8243-8248,8250-
; 8682,8690-8700,8720-8790,9700,9701
I ONCTPCD="C181" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791)) D
..I DATEDX<3230000 S ONCSCMA="00190"
..I DATEDX>3221231 S ONCSCMA="09190"
;
;BILE DUCTS DISTAL: C240 H8000-8700,8720-8790,9700,9701 DISCR1=4,7
I ONCTPCD="C240" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) D
..I ((ONCSDIS1=4)!(ONCSDIS1=7)) S ONCSCMA="00260"
;
;BILE DUCTS INTRAHEPATIC: C221 H8000-8700,8720-8790,9700,9701
I ONCTPCD="C221" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00230"
;
;BILE DUCTS PERIHILAR: C240 H8000-8700,8720-8790,9700-01 DISCR1=1,5,6,9
I ONCTPCD="C240" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) D
..I ((ONCSDIS1=1)!(ONCSDIS1=5)!(ONCSDIS1=6)!(ONCSDIS1=9)) S ONCSCMA="00250"
;
;BILARY OTHER: C248-249 H8000-8700,8720-8790,9700,9701
I "C248^C249"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00278"
;
;BLADDER: C670-679 H8000-8700,8720-8790,9700,9701
I "C670^C671^C672^C673^C674^C675^C676^C677^C678^C679"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00620"
;
;BONE APPENDICULAR SKELETON: C400-403,408-411,413,418,419 H8000-8934,8940-9137,9141-9582,9700,9701
I "C400^C401^C402^C403^C408^C409^C410^C411^C413^C418^C419"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8935))!((HST14>8939)&(HST14<9138))!((HST14>9140)&(HST14<9583))!(HST14=9700)!(HST14=9701) S ONCSCMA="00381"
;
;BONE PELVIS: C414 H8000-8934,8940-9137,9141-9582,9700,9701
I ONCTPCD="C414" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8935))!((HST14>8939)&(HST14<9138))!((HST14>9140)&(HST14<9583))!(HST14=9700)!(HST14=9701) S ONCSCMA="00383"
;
;BONE SPINE: C412 H8000-8934,8940-9137,9141-9582,9700,9701
I ONCTPCD="C412" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8935))!((HST14>8939)&(HST14<9138))!((HST14>9140)&(HST14<9583))!(HST14=9700)!(HST14=9701) S ONCSCMA="00382"
;
;BRAIN: do ONCSCHMV with V9 updates
D BRN721^ONCSCHMV I ONCSCMA'=0 Q
;
;BREAST: C500-506,508,509 H8000-8700,8982,8983,9700,9701
; or C501-506,508,509 H8720-8790
I "C500^C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!(HST14=8982)!(HST14=8983)!(HST14=9700)!(HST14=9701) S ONCSCMA="00480"
I "C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>8719)&(HST14<8791)) S ONCSCMA="00480"
;
;BUCCAL MUCOSA: C060,C061 H8000-8700,8982,9700,9701
I "C060^C061"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!(HST14=8982)!(HST14=9700)!(HST14=9701) S ONCSCMA="00076"
;
;CERVICAL LYMPH NODES AND UNKNOWN PRIMARY: C760 H8000-8700,8720-8790
; 8941,9700,9701
I ONCTPCD="C760" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=8941)!(HST14=9700)!(HST14=9701) S ONCSCMA="00060"
;
;CERVIX: C530,C531,C538,C539 H8000-8700,8720-8790,8805,8933,8980,9110
; 9700,9701
I "C530^C531^C538^C539"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>8709)&(HST14<8715))!((HST14>8799)&(HST14<8804))!(HST14=8805)!((HST14>8809)&(HST14<8815))!((HST14>8815)&(HST14<8859))!((HST14>8859)&(HST14<8901))!((HST14>8901)&(HST14<8911)) S ONCSCMA="00528"
.I ((HST14>8920)&(HST14<8942))!((HST14>8950)&(HST14<8977))!((HST14>8980)&(HST14<8991))!((HST14>8991)&(HST14<9017))!((HST14>9029)&(HST14<9044))!((HST14>9044)&(HST14<9106))!(HST14=9111) S ONCSCMA="00528"
.I ((HST14>9120)&(HST14<9133))!((HST14>9134)&(HST14<9139))!((HST14>9140)&(HST14<9176))!((HST14>9180)&(HST14<9222))!(HST14=9230) S ONCSCMA="00528"
.I ((HST14>9239)&(HST14<9366))!((HST14>9369)&(HST14<9581))!(HST14=9582) S ONCSCMA="00528"
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=8933)!(HST14=8980)!(HST14=9110)!(HST14=9700)!(HST14=9701) D
..I DATEDX<3210000 S ONCSCMA="00520"
..I DATEDX>3201231 S ONCSCMA="09520"
;
;CNS OTHER: https://staging.seer.cancer.gov/eod_public/schema/1.7/cns_other/?breadcrumbs=(~schema_list~)
D CNS722^ONCSCHMV I ONCSCMA'=0 Q
;
;COLON AND RECTUM: C180,C182-189,C199,C209 H8000-8149,8154,8157,8160-
; 8231,8243-8248,8250-8682,8690-8700,8720-8790,9700,9701
I "C180^C182^C183^C184^C185^C186^C187^C188^C189^C199^C209"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00200"
;
;CONJUNCTIVA: C690 H8000-8700,9700,9701
I ONCTPCD="C690" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCSCMA="00650"
;
;CORPUS ADENOSARCOMA: C540-543,C548-549,C559 H8933
I "C540^C541^C542^C543^C548^C549^C559"[ONCTPCD D I ONCSCMA'=0 Q
.I HST14=8933 S ONCSCMA="00542"
;
;CORPUS CARCINOMA & CARCINOSARCOMA: C540-543,C548-549,C559 H8000-8700,
; 8720-8790,8950,8980,9700,9701
I "C540^C541^C542^C543^C548^C549^C559"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=8950)!(HST14=8980)!(HST14=9700)!(HST14=9701) S ONCSCMA="00530"
;
;CORPUS SARCOMA: C540-543,C548-549,C559 H8710-8714,8800-8932,8934-8941,8951-8975,8981-9137,9141-9582
I "C540^C541^C542^C543^C548^C549^C559"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>8709)&(HST14<8715))!((HST14>8799)&(HST14<8933))!((HST14>8933)&(HST14<8942))!((HST14>8950)&(HST14<8976))!((HST14>8980)&(HST14<9138))!((HST14>9140)&(HST14<9583)) S ONCSCMA="00541"
;
;CUTANEOUS SQUAMOUS CELL CARCINOMA OF HEAD & NECK: C000-002,C006,
; C440,C442-444 H8000-8040,8042-8180,8191-8246,8248-8700,8940,8982
I "C000^C001^C002^C006^C440^C442^C443^C444"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8041))!((HST14>8041)&(HST14<8181))!((HST14>8190)&(HST14<8247))!((HST14>8247)&(HST14<8701))!(HST14=8940)!(HST14=8982) S ONCSCMA="00150"
;
;CYSTIC DUCT: C240 H8000-8700,8720-8790,9700,9701 DISCR=3
I ONCTPCD="C240" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) D
..I ONCSDIS1=3 S ONCSCMA="00242"
;
;DIGESTIVE OTHER: C260,C268-269 H8000-8700,8720-8790,9700,9701
I "C260^C268^C269^"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00288"
;
;ENDOCRINE OTHER: C754,C758-759 H8000-8700,8720-8790,9700,9701
; or C755 H8000-8671,8681-8683,8691,8720-8790,9700,9701
I "C754^C758^C759"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00778"
I ONCTPCD="C755" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8672))!((HST14>8680)&(HST14<8684))!(HST14=8691)!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00778"
;
;ESOPHAGUS (INCLUDING GE JUNCTION)(EXCLUDING SQUAMOUS)(ADENOCARCINOMA):
; C150-155,C158-159 H8000-8015,8021-8046,8060,8071-8073,8075-8076,
; 8078-8082,8084-8552,8561-8700,8720-8790,9700,9701
; or C160 H8000-8015,8021-8046,8060,8071-8073,8075-8076,
; 8078-8082,8084-8149,8154,8157,8160-8231,8243-8248,8250-8552,
; 8561-8682,8690-8700,8720-8790,9700,9701 DISCR1=2
; or C150-155,C158-159 H8020 DISCR2=2
; or C160 H8020 DISCR1=2 AND DISCR2=2
I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8016))!((HST14>8020)&(HST14<8047))!(HST14=8060)!((HST14>8070)&(HST14<8074))!((HST14>8074)&(HST14<8077)) S ONCSCMA="00169"
.I ((HST14>8077)&(HST14<8083))!((HST14>8083)&(HST14<8553))!((HST14>8560)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCSCMA="00169"
I ONCTPCD="C160" D I ONCSCMA'=0 Q
.I ((HST14>7999)&(HST14<8016))!((HST14>8020)&(HST14<8047))!(HST14=8060)!((HST14>8070)&(HST14<8074))!((HST14>8074)&(HST14<8077)) D
..I ONCSDIS1=2 S ONCSCMA="00169"
.I ((HST14>8077)&(HST14<8083))!((HST14>8083)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249)) D
..I ONCSDIS1=2 S ONCSCMA="00169"
.I ((HST14>8249)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) D
..I ONCSDIS1=2 S ONCSCMA="00169"
I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D I ONCSCMA'=0 Q
.I (HST14=8020)&(ONCSDIS2=2) S ONCSCMA="00169"
I ONCTPCD="C160" D I ONCSCMA'=0 Q
.I (HST14=8020)&((ONCSDIS1=2)&(ONCSDIS2=2)) S ONCSCMA="00169"
;
;ESOPHAGUS (INCLUDING GE JUNCTION)(SQUAMOUS):
; C150-155,C158-159 H8050-8054,8070,8074,8077,8083,8560
; or C160 H8050-8054,8070,8074,8077,8083,8560 DISCR1=2
; or C150-155,C158-159 H8020 DISCR2=1,9
; or C160 H8020 DISCR1=2 AND DISCR2=1,9
I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D I ONCSCMA'=0 Q
.I ((HST14>8049)&(HST14<8055))!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560) S ONCSCMA="00161"
I ONCTPCD="C160" D I ONCSCMA'=0 Q
.I ((HST14>8049)&(HST14<8055))!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560) D
..I ONCSDIS1=2 S ONCSCMA="00161"
I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D I ONCSCMA'=0 Q
.I (HST14=8020)&((ONCSDIS2=1)!(ONCSDIS2=9)) S ONCSCMA="00161"
I ONCTPCD="C160" D I ONCSCMA'=0 Q
.I (HST14=8020)&(ONCSDIS1=2)&((ONCSDIS2=1)!(ONCSDIS2=9)) S ONCSCMA="00161"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSCHMA 12312 printed Oct 16, 2024@18:28:37 Page 2
ONCSCHMA ;HINES OIFO/RTK - Schema derivation and related code ;04/27/18
+1 ;;2.2;ONCOLOGY;**10,12,13,17,18**;Jul 31, 2013;Build 5
+2 ;
DER ;Derive the correct SCHEMA ID for the abstract based on Primary Site,
+1 ; Histology and possibly Schema Discriminators and Sex
+2 ; AND Store the SCHEMA ID in field #165.5,#3800
+3 ; TOPCOD should be set in Abstract
+4 NEW ONCHIST,ONCTPCD,ONCSDIS1,ONCSDIS2,ONCSSEX,ONCT3,HST14
+5 ;initialize the schema first
SET ONCSCMA=0
+6 SET ONCHIST=$$HIST^ONCFUNC(D0)
+7 IF '$DATA(TOPCOD)!('$DATA(ONCHIST))
WRITE !!," ** MISSING PRIMARY SITE AND/OR HISTOLOGY -- CANNOT DERIVE SCHEMA **",!
QUIT
+8 ;remove the "."
SET ONCTPCD=$PIECE(TOPCOD,".",1)_$PIECE(TOPCOD,".",2)
+9 SET HST14=$EXTRACT(ONCHIST,1,4)
SET HST5=$EXTRACT(ONCHIST,5)
SET ONCT3=$EXTRACT(ONCTPCD,2,5)
+10 ; Schema Discriminator 1
SET ONCSDIS1=$PIECE($GET(^ONCO(165.5,D0,"SSD4")),U,21)
+11 ; Schema Discriminator 2
SET ONCSDIS2=$PIECE($GET(^ONCO(165.5,D0,"SSD4")),U,22)
+12 ; Schema Discriminator 3
SET ONCSDIS3=$PIECE($GET(^ONCO(165.5,D0,"SSD4")),U,23)
+13 SET ONCPTPR=$PIECE($GET(^ONCO(165.5,D0,0)),U,2)
SET ONCSSEX=$PIECE($GET(^ONCO(160,ONCPTPR,0)),U,8)
IF $GET(ONCSSEX)=""
WRITE "CHECK PATIENT'S SEX FIELD IN PATIENT FILE"
HANG 2
+14 ;
+15 DO SCMA
+16 IF ONCSCMA=0
DO ^ONCSCHMB
+17 IF ONCSCMA=0
DO ^ONCSCHMC
+18 IF ONCSCMA=0
DO ^ONCSCHMD
+19 IF ONCSCMA=0
DO ^ONCSCHME
+20 ;
+21 IF ONCSCMA=0
WRITE !!," ** UNABLE TO DERIVE SCHEMA **",!!
+22 IF ONCSCMA'=0
SET $PIECE(^ONCO(165.5,D0,"SSD1"),U,1)=ONCSCMA
+23 ;
+24 KILL ONCPTPR
QUIT
+25 ;
+26 ;
SCMA ; go through until hit is found, else return ONCSCMA=0
+1 ;
+2 ;ADNEXA UTERINE OTHER: C571-C574 HIST 8000-8700,8720-8790,9700,9701
+3 IF "C571^C572^C573^C574"[ONCTPCD
Begin DoDot:1
+4 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))
SET ONCSCMA="00558"
End DoDot:1
IF ONCSCMA'=0
QUIT
+5 ;
+6 ;ADRENAL GLAND: C740,C741,C749 H8000-8671,8681-8683,8691,8720-8790,
+7 ; 9700,9701
+8 IF "C740^C741^C749"[ONCTPCD
Begin DoDot:1
+9 IF ((HST14>7999)&(HST14<8672))!((HST14>8680)&(HST14<8684))!((HST14>8719)&(HST14<8791))!(HST14=8691)!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00760"
End DoDot:1
IF ONCSCMA'=0
QUIT
+10 ;
+11 ;AMPULLA OF VATER: C241 H8000-8149,8154,8157,8160-8231,8243-8248,8250-
+12 ; 8682,8690-8700,8720-8790,9700,9701
+13 IF ONCTPCD="C241"
Begin DoDot:1
+14 IF ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00270"
End DoDot:1
IF ONCSCMA'=0
QUIT
+15 ;
+16 ;ANUS: C210-C212,C218 H8000-8700,9700,9701
+17 ; or C211-C212,C218 H8720-8790
+18 IF "C210^C211^C212^C218"[ONCTPCD
Begin DoDot:1
+19 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))
Begin DoDot:2
+20 IF DATEDX<3230000
SET ONCSCMA="00210"
+21 IF DATEDX>3221231
SET ONCSCMA="09210"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+22 ;
+23 ;APPENDIX: C181 H8000-8149,8154,8157,8160-8231,8243-8248,8250-
+24 ; 8682,8690-8700,8720-8790,9700,9701
+25 IF ONCTPCD="C181"
Begin DoDot:1
+26 IF ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))
Begin DoDot:2
+27 IF DATEDX<3230000
SET ONCSCMA="00190"
+28 IF DATEDX>3221231
SET ONCSCMA="09190"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+29 ;
+30 ;BILE DUCTS DISTAL: C240 H8000-8700,8720-8790,9700,9701 DISCR1=4,7
+31 IF ONCTPCD="C240"
Begin DoDot:1
+32 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
Begin DoDot:2
+33 IF ((ONCSDIS1=4)!(ONCSDIS1=7))
SET ONCSCMA="00260"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+34 ;
+35 ;BILE DUCTS INTRAHEPATIC: C221 H8000-8700,8720-8790,9700,9701
+36 IF ONCTPCD="C221"
Begin DoDot:1
+37 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00230"
End DoDot:1
IF ONCSCMA'=0
QUIT
+38 ;
+39 ;BILE DUCTS PERIHILAR: C240 H8000-8700,8720-8790,9700-01 DISCR1=1,5,6,9
+40 IF ONCTPCD="C240"
Begin DoDot:1
+41 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
Begin DoDot:2
+42 IF ((ONCSDIS1=1)!(ONCSDIS1=5)!(ONCSDIS1=6)!(ONCSDIS1=9))
SET ONCSCMA="00250"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+43 ;
+44 ;BILARY OTHER: C248-249 H8000-8700,8720-8790,9700,9701
+45 IF "C248^C249"[ONCTPCD
Begin DoDot:1
+46 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00278"
End DoDot:1
IF ONCSCMA'=0
QUIT
+47 ;
+48 ;BLADDER: C670-679 H8000-8700,8720-8790,9700,9701
+49 IF "C670^C671^C672^C673^C674^C675^C676^C677^C678^C679"[ONCTPCD
Begin DoDot:1
+50 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00620"
End DoDot:1
IF ONCSCMA'=0
QUIT
+51 ;
+52 ;BONE APPENDICULAR SKELETON: C400-403,408-411,413,418,419 H8000-8934,8940-9137,9141-9582,9700,9701
+53 IF "C400^C401^C402^C403^C408^C409^C410^C411^C413^C418^C419"[ONCTPCD
Begin DoDot:1
+54 IF ((HST14>7999)&(HST14<8935))!((HST14>8939)&(HST14<9138))!((HST14>9140)&(HST14<9583))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00381"
End DoDot:1
IF ONCSCMA'=0
QUIT
+55 ;
+56 ;BONE PELVIS: C414 H8000-8934,8940-9137,9141-9582,9700,9701
+57 IF ONCTPCD="C414"
Begin DoDot:1
+58 IF ((HST14>7999)&(HST14<8935))!((HST14>8939)&(HST14<9138))!((HST14>9140)&(HST14<9583))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00383"
End DoDot:1
IF ONCSCMA'=0
QUIT
+59 ;
+60 ;BONE SPINE: C412 H8000-8934,8940-9137,9141-9582,9700,9701
+61 IF ONCTPCD="C412"
Begin DoDot:1
+62 IF ((HST14>7999)&(HST14<8935))!((HST14>8939)&(HST14<9138))!((HST14>9140)&(HST14<9583))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00382"
End DoDot:1
IF ONCSCMA'=0
QUIT
+63 ;
+64 ;BRAIN: do ONCSCHMV with V9 updates
+65 DO BRN721^ONCSCHMV
IF ONCSCMA'=0
QUIT
+66 ;
+67 ;BREAST: C500-506,508,509 H8000-8700,8982,8983,9700,9701
+68 ; or C501-506,508,509 H8720-8790
+69 IF "C500^C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD
Begin DoDot:1
+70 IF ((HST14>7999)&(HST14<8701))!(HST14=8982)!(HST14=8983)!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00480"
End DoDot:1
IF ONCSCMA'=0
QUIT
+71 IF "C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD
Begin DoDot:1
+72 IF ((HST14>8719)&(HST14<8791))
SET ONCSCMA="00480"
End DoDot:1
IF ONCSCMA'=0
QUIT
+73 ;
+74 ;BUCCAL MUCOSA: C060,C061 H8000-8700,8982,9700,9701
+75 IF "C060^C061"[ONCTPCD
Begin DoDot:1
+76 IF ((HST14>7999)&(HST14<8701))!(HST14=8982)!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00076"
End DoDot:1
IF ONCSCMA'=0
QUIT
+77 ;
+78 ;CERVICAL LYMPH NODES AND UNKNOWN PRIMARY: C760 H8000-8700,8720-8790
+79 ; 8941,9700,9701
+80 IF ONCTPCD="C760"
Begin DoDot:1
+81 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=8941)!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00060"
End DoDot:1
IF ONCSCMA'=0
QUIT
+82 ;
+83 ;CERVIX: C530,C531,C538,C539 H8000-8700,8720-8790,8805,8933,8980,9110
+84 ; 9700,9701
+85 IF "C530^C531^C538^C539"[ONCTPCD
Begin DoDot:1
+86 IF ((HST14>8709)&(HST14<8715))!((HST14>8799)&(HST14<8804))!(HST14=8805)!((HST14>8809)&(HST14<8815))!((HST14>8815)&(HST14<8859))!((HST14>8859)&(HST14<8901))!((HST14>8901)&(HST14<8911))
SET ONCSCMA="00528"
+87 IF ((HST14>8920)&(HST14<8942))!((HST14>8950)&(HST14<8977))!((HST14>8980)&(HST14<8991))!((HST14>8991)&(HST14<9017))!((HST14>9029)&(HST14<9044))!((HST14>9044)&(HST14<9106))!(HST14=9111)
SET ONCSCMA="00528"
+88 IF ((HST14>9120)&(HST14<9133))!((HST14>9134)&(HST14<9139))!((HST14>9140)&(HST14<9176))!((HST14>9180)&(HST14<9222))!(HST14=9230)
SET ONCSCMA="00528"
+89 IF ((HST14>9239)&(HST14<9366))!((HST14>9369)&(HST14<9581))!(HST14=9582)
SET ONCSCMA="00528"
+90 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=8933)!(HST14=8980)!(HST14=9110)!(HST14=9700)!(HST14=9701)
Begin DoDot:2
+91 IF DATEDX<3210000
SET ONCSCMA="00520"
+92 IF DATEDX>3201231
SET ONCSCMA="09520"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+93 ;
+94 ;CNS OTHER: https://staging.seer.cancer.gov/eod_public/schema/1.7/cns_other/?breadcrumbs=(~schema_list~)
+95 DO CNS722^ONCSCHMV
IF ONCSCMA'=0
QUIT
+96 ;
+97 ;COLON AND RECTUM: C180,C182-189,C199,C209 H8000-8149,8154,8157,8160-
+98 ; 8231,8243-8248,8250-8682,8690-8700,8720-8790,9700,9701
+99 IF "C180^C182^C183^C184^C185^C186^C187^C188^C189^C199^C209"[ONCTPCD
Begin DoDot:1
+100 IF ((HST14>7999)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))!((HST14>8249)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00200"
End DoDot:1
IF ONCSCMA'=0
QUIT
+101 ;
+102 ;CONJUNCTIVA: C690 H8000-8700,9700,9701
+103 IF ONCTPCD="C690"
Begin DoDot:1
+104 IF ((HST14>7999)&(HST14<8701))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00650"
End DoDot:1
IF ONCSCMA'=0
QUIT
+105 ;
+106 ;CORPUS ADENOSARCOMA: C540-543,C548-549,C559 H8933
+107 IF "C540^C541^C542^C543^C548^C549^C559"[ONCTPCD
Begin DoDot:1
+108 IF HST14=8933
SET ONCSCMA="00542"
End DoDot:1
IF ONCSCMA'=0
QUIT
+109 ;
+110 ;CORPUS CARCINOMA & CARCINOSARCOMA: C540-543,C548-549,C559 H8000-8700,
+111 ; 8720-8790,8950,8980,9700,9701
+112 IF "C540^C541^C542^C543^C548^C549^C559"[ONCTPCD
Begin DoDot:1
+113 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=8950)!(HST14=8980)!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00530"
End DoDot:1
IF ONCSCMA'=0
QUIT
+114 ;
+115 ;CORPUS SARCOMA: C540-543,C548-549,C559 H8710-8714,8800-8932,8934-8941,8951-8975,8981-9137,9141-9582
+116 IF "C540^C541^C542^C543^C548^C549^C559"[ONCTPCD
Begin DoDot:1
+117 IF ((HST14>8709)&(HST14<8715))!((HST14>8799)&(HST14<8933))!((HST14>8933)&(HST14<8942))!((HST14>8950)&(HST14<8976))!((HST14>8980)&(HST14<9138))!((HST14>9140)&(HST14<9583))
SET ONCSCMA="00541"
End DoDot:1
IF ONCSCMA'=0
QUIT
+118 ;
+119 ;CUTANEOUS SQUAMOUS CELL CARCINOMA OF HEAD & NECK: C000-002,C006,
+120 ; C440,C442-444 H8000-8040,8042-8180,8191-8246,8248-8700,8940,8982
+121 IF "C000^C001^C002^C006^C440^C442^C443^C444"[ONCTPCD
Begin DoDot:1
+122 IF ((HST14>7999)&(HST14<8041))!((HST14>8041)&(HST14<8181))!((HST14>8190)&(HST14<8247))!((HST14>8247)&(HST14<8701))!(HST14=8940)!(HST14=8982)
SET ONCSCMA="00150"
End DoDot:1
IF ONCSCMA'=0
QUIT
+123 ;
+124 ;CYSTIC DUCT: C240 H8000-8700,8720-8790,9700,9701 DISCR=3
+125 IF ONCTPCD="C240"
Begin DoDot:1
+126 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
Begin DoDot:2
+127 IF ONCSDIS1=3
SET ONCSCMA="00242"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+128 ;
+129 ;DIGESTIVE OTHER: C260,C268-269 H8000-8700,8720-8790,9700,9701
+130 IF "C260^C268^C269^"[ONCTPCD
Begin DoDot:1
+131 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00288"
End DoDot:1
IF ONCSCMA'=0
QUIT
+132 ;
+133 ;ENDOCRINE OTHER: C754,C758-759 H8000-8700,8720-8790,9700,9701
+134 ; or C755 H8000-8671,8681-8683,8691,8720-8790,9700,9701
+135 IF "C754^C758^C759"[ONCTPCD
Begin DoDot:1
+136 IF ((HST14>7999)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00778"
End DoDot:1
IF ONCSCMA'=0
QUIT
+137 IF ONCTPCD="C755"
Begin DoDot:1
+138 IF ((HST14>7999)&(HST14<8672))!((HST14>8680)&(HST14<8684))!(HST14=8691)!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00778"
End DoDot:1
IF ONCSCMA'=0
QUIT
+139 ;
+140 ;ESOPHAGUS (INCLUDING GE JUNCTION)(EXCLUDING SQUAMOUS)(ADENOCARCINOMA):
+141 ; C150-155,C158-159 H8000-8015,8021-8046,8060,8071-8073,8075-8076,
+142 ; 8078-8082,8084-8552,8561-8700,8720-8790,9700,9701
+143 ; or C160 H8000-8015,8021-8046,8060,8071-8073,8075-8076,
+144 ; 8078-8082,8084-8149,8154,8157,8160-8231,8243-8248,8250-8552,
+145 ; 8561-8682,8690-8700,8720-8790,9700,9701 DISCR1=2
+146 ; or C150-155,C158-159 H8020 DISCR2=2
+147 ; or C160 H8020 DISCR1=2 AND DISCR2=2
+148 IF "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD
Begin DoDot:1
+149 IF ((HST14>7999)&(HST14<8016))!((HST14>8020)&(HST14<8047))!(HST14=8060)!((HST14>8070)&(HST14<8074))!((HST14>8074)&(HST14<8077))
SET ONCSCMA="00169"
+150 IF ((HST14>8077)&(HST14<8083))!((HST14>8083)&(HST14<8553))!((HST14>8560)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCSCMA="00169"
End DoDot:1
IF ONCSCMA'=0
QUIT
+151 IF ONCTPCD="C160"
Begin DoDot:1
+152 IF ((HST14>7999)&(HST14<8016))!((HST14>8020)&(HST14<8047))!(HST14=8060)!((HST14>8070)&(HST14<8074))!((HST14>8074)&(HST14<8077))
Begin DoDot:2
+153 IF ONCSDIS1=2
SET ONCSCMA="00169"
End DoDot:2
+154 IF ((HST14>8077)&(HST14<8083))!((HST14>8083)&(HST14<8150))!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8232))!((HST14>8242)&(HST14<8249))
Begin DoDot:2
+155 IF ONCSDIS1=2
SET ONCSCMA="00169"
End DoDot:2
+156 IF ((HST14>8249)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
Begin DoDot:2
+157 IF ONCSDIS1=2
SET ONCSCMA="00169"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+158 IF "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD
Begin DoDot:1
+159 IF (HST14=8020)&(ONCSDIS2=2)
SET ONCSCMA="00169"
End DoDot:1
IF ONCSCMA'=0
QUIT
+160 IF ONCTPCD="C160"
Begin DoDot:1
+161 IF (HST14=8020)&((ONCSDIS1=2)&(ONCSDIS2=2))
SET ONCSCMA="00169"
End DoDot:1
IF ONCSCMA'=0
QUIT
+162 ;
+163 ;ESOPHAGUS (INCLUDING GE JUNCTION)(SQUAMOUS):
+164 ; C150-155,C158-159 H8050-8054,8070,8074,8077,8083,8560
+165 ; or C160 H8050-8054,8070,8074,8077,8083,8560 DISCR1=2
+166 ; or C150-155,C158-159 H8020 DISCR2=1,9
+167 ; or C160 H8020 DISCR1=2 AND DISCR2=1,9
+168 IF "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD
Begin DoDot:1
+169 IF ((HST14>8049)&(HST14<8055))!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560)
SET ONCSCMA="00161"
End DoDot:1
IF ONCSCMA'=0
QUIT
+170 IF ONCTPCD="C160"
Begin DoDot:1
+171 IF ((HST14>8049)&(HST14<8055))!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560)
Begin DoDot:2
+172 IF ONCSDIS1=2
SET ONCSCMA="00161"
End DoDot:2
End DoDot:1
IF ONCSCMA'=0
QUIT
+173 IF "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD
Begin DoDot:1
+174 IF (HST14=8020)&((ONCSDIS2=1)!(ONCSDIS2=9))
SET ONCSCMA="00161"
End DoDot:1
IF ONCSCMA'=0
QUIT
+175 IF ONCTPCD="C160"
Begin DoDot:1
+176 IF (HST14=8020)&(ONCSDIS1=2)&((ONCSDIS2=1)!(ONCSDIS2=9))
SET ONCSCMA="00161"
End DoDot:1
IF ONCSCMA'=0
QUIT
+177 QUIT