ONCOSA1 ;WASH ISC/SRR-ANNUAL CROSS TABS-CANNED REPORTS-TASKED JOB ;12/14/99
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
Q ;NOT A RUN ROUTINE
;
TSK ;Tasked job to print all cross tab tables
1 S J=0 F NM="NON ANAL","ANALYTIC","ALLCASES" S D0=$O(^DIBT("F165.5","ONCOS RANGE-"_NM,0)) Q:D0="" S KD(J)=D0,$P(^DIBT(D0,0),U,2)=DT,J=J+1 K ^DIBT(D0,1)
S RG=ONCOS("RG"),Y1=$P(RG,U),Y2=$P(RG,U,2) F YR=Y1:1:Y2 S D0=0 D
.F S D0=$O(^ONCO(165.5,"AY",YR,D0)) Q:D0'>0 I $$DIV^ONCFUNC(D0)=DUZ(2) S CC=+$P(^ONCO(165.5,D0,0),U,20),^DIBT(KD(CC),1,D0)="",^DIBT(KD(2),1,D0)=""
2 F J=0 F NM="NON ANAL","ANALYTIC","ALLCASES" S D0=$O(^DIBT("F165.5","ONCOS ANNUAL-"_NM,0)) Q:D0="" S XD(J)=D0,$P(^DIBT(D0,0),U,2)=DT,J=J+1 K ^DIBT(D0,1)
S YR=+ONCOS("YR"),D0=0 F S D0=$O(^ONCO(165.5,"AY",YR,D0)) Q:D0="" I $$DIV^ONCFUNC(D0)=DUZ(2) S CC=+$P(^ONCO(165.5,D0,0),U,20),^DIBT(XD(CC),1,D0)="",^DIBT(XD(2),1,D0)=""
3 ;Setup templates for Stage/Treatment
F G="0","I","II","III","IV","U","NA" D
.S D0=$O(^DIBT("F165.5","ONCOS ANAL/STAGE "_G,0)) Q:D0'>0 K ^DIBT(D0,1) S XD(G)=D0,$P(^DIBT(D0,0),U,2)=DT
S D0=0 F S D0=$O(^ONCO(165.5,"AG",1,D0)) Q:D0'>0 I $$DIV^ONCFUNC(D0)=DUZ(2) S G=$P($G(^ONCO(165.5,D0,2)),U,28) I G'="" S ^DIBT(XD(G),1,D0)=""
;
4 F G=0,"I","II","III","IV","U","NA" D
.S D0=$O(^DIBT("F165.5","ONCOS ANNUAL ANAL/STAGE "_G,0)) Q:D0'>0 K ^DIBT(D0,1) S XD(G)=D0,$P(^DIBT(D0,0),U,2)=DT
S D0=0 F S D0=$O(^ONCO(165.5,"AY",YR,D0)) Q:D0'>0 I $$DIV^ONCFUNC(D0)=DUZ(2) S G=$P($G(^ONCO(165.5,D0,2)),U,28) I G'="" S ^DIBT(XD(G),1,D0)=""
TAB ;Call to do crosstabs for each case
;Given ONCOS("R")=row,ONCOS("P")=percentages
;Reset ONCOS("C") and ONCOS("T")
S ONCOEX=0,ONCOS("TK")=1,ONCOS("F")="ONCOLOGY PRIMARY",(ONCOS("N"),ONCOS("Y"))=""
R S ONCOS("T")="ONCOS RANGE-ALLCASES",ONCOS("C")="CLASS CATEGORY" D PRINT^ONCOSCT Q:ONCOEX
F NM="ALLCASES","NON ANAL","ANALYTIC" Q:ONCOEX S ONCOS("T")="ONCOS RANGE-"_NM D
.F I=2:1:13 Q:ONCOEX D
..S ONCOS("C")=$P($T(COL+I),";",3) D PRINT^ONCOSCT
Q:ONCOEX F I=14:1:17 Q:ONCOEX D
.S ONCOS("C")=$P($T(COL+I),";",3) D PRINT^ONCOSCT
Q:ONCOEX F G=0,"I","II","III","IV","U","NA" Q:ONCOEX D
.S ONCOS("T")="ONCOS ANAL/STAGE "_G,ONCOS("C")="TREATMENT" D PRINT^ONCOSCT
;ANNUAL CASES
AN Q:ONCOEX S ONCOS("T")="ONCOS ANNUAL-ALLCASES",ONCOS("C")="CLASS CATEGORY" D PRINT^ONCOSCT Q:ONCOEX
Q:ONCOEX F NM="ALLCASES","NON ANAL","ANALYTIC" Q:ONCOEX S ONCOS("T")="ONCOS ANNUAL-"_NM D
T .F I=2:1:13 Q:ONCOEX D
..S ONCOS("C")=$P($T(COL+I),";",3) D PRINT^ONCOSCT
Q:ONCOEX F I=14:1:17 Q:ONCOEX D
.S ONCOS("C")=$P($T(COL+I),";",3) D PRINT^ONCOSCT
Q:ONCOEX F G=0,"I","II","III","IV","U","NA" Q:ONCOEX D
.S ONCOS("T")="ONCOS ANNUAL ANAL/STAGE "_G,ONCOS("C")="TREATMENT" D PRINT^ONCOSCT
EX ;EXIT
K ONCOS,RG,YR,Y1,Y2,D0,ONCOEX,ONCOION,ONCOIOM
Q
COL ;List of fields for Columns
;;CLASS CATEGORY
;;ACCESSION YEAR
;;CLASS NO.
;;STATUS
;;SEX
;;RACE
;;RACE-SEX
;;SEX-RACE
;;DX AGE-GP
;;PLACE OF BIRTH
;;MARITAL STATUS AT DX
;;STATE
;;ST-COUNTY
;;SUMMARY STAGE
;;HISTOLOGY
;;STAGE GROUPING-AJCC
;;TREATMENT
;;GP-G AJCC SUMMARY STAGE
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCOSA1 3132 printed Dec 13, 2024@02:25:29 Page 2
ONCOSA1 ;WASH ISC/SRR-ANNUAL CROSS TABS-CANNED REPORTS-TASKED JOB ;12/14/99
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;NOT A RUN ROUTINE
QUIT
+3 ;
TSK ;Tasked job to print all cross tab tables
1 SET J=0
FOR NM="NON ANAL","ANALYTIC","ALLCASES"
SET D0=$ORDER(^DIBT("F165.5","ONCOS RANGE-"_NM,0))
if D0=""
QUIT
SET KD(J)=D0
SET $PIECE(^DIBT(D0,0),U,2)=DT
SET J=J+1
KILL ^DIBT(D0,1)
+1 SET RG=ONCOS("RG")
SET Y1=$PIECE(RG,U)
SET Y2=$PIECE(RG,U,2)
FOR YR=Y1:1:Y2
SET D0=0
Begin DoDot:1
+2 FOR
SET D0=$ORDER(^ONCO(165.5,"AY",YR,D0))
if D0'>0
QUIT
IF $$DIV^ONCFUNC(D0)=DUZ(2)
SET CC=+$PIECE(^ONCO(165.5,D0,0),U,20)
SET ^DIBT(KD(CC),1,D0)=""
SET ^DIBT(KD(2),1,D0)=""
End DoDot:1
2 FOR J=0
FOR NM="NON ANAL","ANALYTIC","ALLCASES"
SET D0=$ORDER(^DIBT("F165.5","ONCOS ANNUAL-"_NM,0))
if D0=""
QUIT
SET XD(J)=D0
SET $PIECE(^DIBT(D0,0),U,2)=DT
SET J=J+1
KILL ^DIBT(D0,1)
+1 SET YR=+ONCOS("YR")
SET D0=0
FOR
SET D0=$ORDER(^ONCO(165.5,"AY",YR,D0))
if D0=""
QUIT
IF $$DIV^ONCFUNC(D0)=DUZ(2)
SET CC=+$PIECE(^ONCO(165.5,D0,0),U,20)
SET ^DIBT(XD(CC),1,D0)=""
SET ^DIBT(XD(2),1,D0)=""
3 ;Setup templates for Stage/Treatment
+1 FOR G="0","I","II","III","IV","U","NA"
Begin DoDot:1
+2 SET D0=$ORDER(^DIBT("F165.5","ONCOS ANAL/STAGE "_G,0))
if D0'>0
QUIT
KILL ^DIBT(D0,1)
SET XD(G)=D0
SET $PIECE(^DIBT(D0,0),U,2)=DT
End DoDot:1
+3 SET D0=0
FOR
SET D0=$ORDER(^ONCO(165.5,"AG",1,D0))
if D0'>0
QUIT
IF $$DIV^ONCFUNC(D0)=DUZ(2)
SET G=$PIECE($GET(^ONCO(165.5,D0,2)),U,28)
IF G'=""
SET ^DIBT(XD(G),1,D0)=""
+4 ;
4 FOR G=0,"I","II","III","IV","U","NA"
Begin DoDot:1
+1 SET D0=$ORDER(^DIBT("F165.5","ONCOS ANNUAL ANAL/STAGE "_G,0))
if D0'>0
QUIT
KILL ^DIBT(D0,1)
SET XD(G)=D0
SET $PIECE(^DIBT(D0,0),U,2)=DT
End DoDot:1
+2 SET D0=0
FOR
SET D0=$ORDER(^ONCO(165.5,"AY",YR,D0))
if D0'>0
QUIT
IF $$DIV^ONCFUNC(D0)=DUZ(2)
SET G=$PIECE($GET(^ONCO(165.5,D0,2)),U,28)
IF G'=""
SET ^DIBT(XD(G),1,D0)=""
TAB ;Call to do crosstabs for each case
+1 ;Given ONCOS("R")=row,ONCOS("P")=percentages
+2 ;Reset ONCOS("C") and ONCOS("T")
+3 SET ONCOEX=0
SET ONCOS("TK")=1
SET ONCOS("F")="ONCOLOGY PRIMARY"
SET (ONCOS("N"),ONCOS("Y"))=""
R SET ONCOS("T")="ONCOS RANGE-ALLCASES"
SET ONCOS("C")="CLASS CATEGORY"
DO PRINT^ONCOSCT
if ONCOEX
QUIT
+1 FOR NM="ALLCASES","NON ANAL","ANALYTIC"
if ONCOEX
QUIT
SET ONCOS("T")="ONCOS RANGE-"_NM
Begin DoDot:1
+2 FOR I=2:1:13
if ONCOEX
QUIT
Begin DoDot:2
+3 SET ONCOS("C")=$PIECE($TEXT(COL+I),";",3)
DO PRINT^ONCOSCT
End DoDot:2
End DoDot:1
+4 if ONCOEX
QUIT
FOR I=14:1:17
if ONCOEX
QUIT
Begin DoDot:1
+5 SET ONCOS("C")=$PIECE($TEXT(COL+I),";",3)
DO PRINT^ONCOSCT
End DoDot:1
+6 if ONCOEX
QUIT
FOR G=0,"I","II","III","IV","U","NA"
if ONCOEX
QUIT
Begin DoDot:1
+7 SET ONCOS("T")="ONCOS ANAL/STAGE "_G
SET ONCOS("C")="TREATMENT"
DO PRINT^ONCOSCT
End DoDot:1
+8 ;ANNUAL CASES
AN if ONCOEX
QUIT
SET ONCOS("T")="ONCOS ANNUAL-ALLCASES"
SET ONCOS("C")="CLASS CATEGORY"
DO PRINT^ONCOSCT
if ONCOEX
QUIT
+1 if ONCOEX
QUIT
FOR NM="ALLCASES","NON ANAL","ANALYTIC"
if ONCOEX
QUIT
SET ONCOS("T")="ONCOS ANNUAL-"_NM
Begin DoDot:1
T FOR I=2:1:13
if ONCOEX
QUIT
Begin DoDot:2
+1 SET ONCOS("C")=$PIECE($TEXT(COL+I),";",3)
DO PRINT^ONCOSCT
End DoDot:2
End DoDot:1
+2 if ONCOEX
QUIT
FOR I=14:1:17
if ONCOEX
QUIT
Begin DoDot:1
+3 SET ONCOS("C")=$PIECE($TEXT(COL+I),";",3)
DO PRINT^ONCOSCT
End DoDot:1
+4 if ONCOEX
QUIT
FOR G=0,"I","II","III","IV","U","NA"
if ONCOEX
QUIT
Begin DoDot:1
+5 SET ONCOS("T")="ONCOS ANNUAL ANAL/STAGE "_G
SET ONCOS("C")="TREATMENT"
DO PRINT^ONCOSCT
End DoDot:1
EX ;EXIT
+1 KILL ONCOS,RG,YR,Y1,Y2,D0,ONCOEX,ONCOION,ONCOIOM
+2 QUIT
COL ;List of fields for Columns
+1 ;;CLASS CATEGORY
+2 ;;ACCESSION YEAR
+3 ;;CLASS NO.
+4 ;;STATUS
+5 ;;SEX
+6 ;;RACE
+7 ;;RACE-SEX
+8 ;;SEX-RACE
+9 ;;DX AGE-GP
+10 ;;PLACE OF BIRTH
+11 ;;MARITAL STATUS AT DX
+12 ;;STATE
+13 ;;ST-COUNTY
+14 ;;SUMMARY STAGE
+15 ;;HISTOLOGY
+16 ;;STAGE GROUPING-AJCC
+17 ;;TREATMENT
+18 ;;GP-G AJCC SUMMARY STAGE