BookmarkSubscribeRSS Feed
SASno0b
Calcite | Level 5

Hi,

 

I have a scheduled program that connects to a database and gathers data every hour.  The program takes roughly 30 seconds to connect to the database and create the tables that I need.  However when I load those tables to LASR within the program, it is taking over 4 minutes to load the 9 tables.  They are very small tables with the biggest one having only 1000 records and the other 8 maybe having 10-15 records each.  Maybe I'm not writing the code efficiently?  Is there a better way to load 9 tables within one program?

 

Within my program I have 9 instances of the code below to load each of the 9 tables. 

/* ********************************************** LOAD QV_OutByTypeAllVsNot55 ********************************************** */


/* ------
* Macro Inputs:
* IN_TABLE - table, with libname reference, to be copied.
* OUT_TABLE - name of the table to be created on LASR.
* ------ */


%macro load_to_lasr(in_table=WORK.QV_OutByTypeAllVsNot55, out_table=Q_OutByTypeAllVsNot55);

 /* Connect to LASR Analytic Server */
 libname esd_lasr sasiola
 tag=vaesd
 port=10034
 host="pl-dr-sas-lasn1.com"
 signer="https://sasreporting2dr.com:443/SASLASRAuthorization";

 /* Drop Physical Table - if exists */
 %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 proc sql noprint;
 drop table esd_lasr.&out_table;
 quit;
 %end;

 /* Drop Table Metadata - if exists */
 %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do;
 proc metalib;
 omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 repname="Foundation"
 );
 select = ("&out_table");
 update_rule = (delete);
 run;
 %end;

 /* Load Table to LASR Analytic Server */
 data esd_lasr.&out_table;
 set &in_table;
 run;
 
 /* Create Metadata for Table - if exists */
 %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 proc metalib;
 omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 repname="Foundation"
 );
 select ("&out_table");
 run;
 %end;
 %else %do;
 %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 %end;

 
%mend load_to_lasr;

%load_to_lasr;


/* ********************************************** LOAD QV_OutByTypeAllVsNot55 ********************************************** */
14 REPLIES 14
ChrisNZ
Tourmaline | Level 20
Proc copy is much faster than a data:step.
SASKiwi
PROC Star

Please post a sample SAS log of your load program using the MPRINT SAS option. We need to understand which steps are slow.

SASno0b
Calcite | Level 5

I added to my program:

 

Where can I find the output file?

options mfile mprint;
filename mprint 'debugStorm';
SASno0b
Calcite | Level 5

I ran the same code from SAS Studio and here is the results from the log tab:

 

I guess part of my question is, is there anyway to run parts of my program in parallel instead of sequentially?

 

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         options mprint;
 74         /*
 75         options mfile mprint;
 76         filename mprint 'debugStorm';
 77         */
 78         
 79         %macro getStormDatesFull;
 80         
 81         %global gblStartStm;
 82         %global gblEndStm;
 83         
 84         %let gblStartStm=;
 85         %let gblEndStm=;
 86         
 87         PROC SQL noprint;
 88         CONNECT TO ORACLE(user=oh password=oh path='gcxp1-scan.livdc.local:1521/ohprd');
 89         /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh55 */
 90         /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 91         /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 91       ! */
 92         /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 92       ! PROD 67 HN */
 93         EXECUTE
 94         (
 95         ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 96         ) BY ORACLE;
 97         
 98         SELECT START_DATETIME INTO :startStorm FROM CONNECTION TO ORACLE
 99         (
 100        
 101        SELECT
 102             (TRUNC(SYSDATE) - 10) AS "START_DATETIME"
 103        FROM DUAL
 104        
 105        )
 106        ;
 107        
 108        SELECT END_DATETIME INTO :endStorm FROM CONNECTION TO ORACLE
 109        (
 110        
 111        SELECT
 112             '.' AS "END_DATETIME"
 113        FROM
 114        (
 115        DUAL
 116        )
 117        
 118        )
 119        ;
 120        
 121        DISCONNECT FROM ORACLE;
 122        QUIT;
 123        
 124        %put STARTTIME IN MACRO: &startStorm;
 125        %put ENDTIME IN MACRO: &endStorm;
 126        
 127        %if (&startStorm NE .) %then %do;
 128        %let gblStartStm = &startStorm;
 129        %end;
 130        %else %do;
 131        %let gblStartStm =;
 132        %end;
 133        
 134        %if (&endStorm EQ .) %then %do;
 135        %let gblEndStm = %sysfunc(intnx(HOUR,%sysfunc(datetime()),0,B),datetime19.);
 136        %end;
 137        
 138        %if (&endStorm NE .) AND %sysevalf( "&endStorm"dt = "%sysfunc(intnx(HOUR,%sysfunc(datetime()),0,B),datetime19.)"dt)
 138      ! %then %do;
 139        %let gblEndStm = &endStorm;
 140        %end;
 141        
 142        %else %if (&endStorm NE .) AND %sysevalf( "&endStorm"dt > "%sysfunc(intnx(HOUR,%sysfunc(datetime()),0,B),datetime19.)"dt
 142      !  )  %then %do;
 143        %let gblEndStm = %sysfunc(intnx(HOUR,%sysfunc(datetime()),0,B),datetime19.);
 144        %end;
 145        
 146        %else %if (&endStorm NE .) AND %sysevalf( "&endStorm"dt < "%sysfunc(intnx(HOUR,%sysfunc(datetime()),0,B),datetime19.)"dt
 146      !  )  %then %do;
 147        %let gblEndStm = &endStorm;
 148        %end;
 149        
 150        %put CURRENT TIMEVALUE: %sysfunc(intnx(HOUR,%sysfunc(datetime()),0,B),datetime19.);
 151        %put UPDATED ENDTIME VALUE: &gblEndStm;
 152        
 153        /*
 154        %let gblStartStm = &startStorm;
 155        %let gblEndStm = &endStorm;
 156        */
 157        
 158        %put STARTTIME IN GLOBAL: &gblStartStm;
 159        %put ENDTIME IN GLOBAL: &gblEndStm;
 160        
 161        %put "The start of the Storm is: &startStorm";
 162        %put "The end of the Storm is: &endStorm";
 163        
 164        %mend;
 165        
 166        %getStormDatesFull;
 MPRINT(GETSTORMDATESFULL):   PROC SQL noprint;
 MPRINT(GETSTORMDATESFULL):   CONNECT TO ORACLE(user=oh password=oh path='gcxp1-scan.livdc.local:1521/ohprd');
 MPRINT(GETSTORMDATESFULL):   EXECUTE ( ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS' ) BY ORACLE;
 MPRINT(GETSTORMDATESFULL):   SELECT START_DATETIME INTO :startStorm FROM CONNECTION TO ORACLE ( SELECT (TRUNC(SYSDATE) - 10) AS 
 "START_DATETIME" FROM DUAL ) ;

 MPRINT(GETSTORMDATESFULL):   SELECT END_DATETIME INTO :endStorm FROM CONNECTION TO ORACLE ( SELECT '.' AS "END_DATETIME" FROM ( 
 DUAL ) ) ;
 MPRINT(GETSTORMDATESFULL):   DISCONNECT FROM ORACLE;
 MPRINT(GETSTORMDATESFULL):   QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.21 seconds
       cpu time            0.02 seconds
       
 
 STARTTIME IN MACRO:   24SEP2021:00:00:00
 ENDTIME IN MACRO: .
 CURRENT TIMEVALUE:  04OCT2021:09:00:00
 UPDATED ENDTIME VALUE: 04OCT2021:09:00:00
 STARTTIME IN GLOBAL: 24SEP2021:00:00:00
 ENDTIME IN GLOBAL: 04OCT2021:09:00:00
 "The start of the Storm is:   24SEP2021:00:00:00"
 "The end of the Storm is: ."
 167        
 168        %put "HELLO WORLD";
 "HELLO WORLD"
 169        
 170        /*
 171        %put "The start of the Storm is: &startStorm";
 172        %put "The end of the Storm is: &endStorm";
 173        */
 174        
 175        
 176        data _null_;
 177         if exist ("WORK.STORM_SETTINGS_DASH") then call execute("proc datasets library=work; delete STORM_SETTINGS_DASH;run;quit
 177      ! ;") ;
 178        run;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 NOTE: CALL EXECUTE generated line.
 1         + proc datasets library=work;
 1         +                             delete STORM_SETTINGS_DASH;run;
 
 NOTE: Deleting WORK.STORM_SETTINGS_DASH (memtype=DATA).

 1         +                                                            quit;
 
 NOTE: PROCEDURE DATASETS used (Total process time):
       real time           0.31 seconds
       cpu time            0.29 seconds
       
 
 179        
 180        data _null_;
 181         if exist ("WORK.GLOBALETR_DASH") then call execute("proc datasets library=work; delete GLOBALETR_DASH;run;quit;") ;
 182        run;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 183        
 184        PROC SQL;
 185        CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan:1521/ohprd');
 186        /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 187        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 187      ! */
 188        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 188      ! PROD 67 HN */
 189        EXECUTE
 190        (
 191        ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 192        ) BY ORACLE;
 193        CREATE TABLE WORK.STORM_SETTINGS_DASH AS
 194        SELECT * FROM CONNECTION TO ORACLE
 195        (
 196        
 197        SELECT
 198        ALL_RECS.LAST_MODIFIED_BY
 199        ,ALL_RECS.LAST_MODIFIED_ON
 200        ,ALL_RECS.STORM_ID
 201        ,ALL_RECS.DISTRICT
 202        ,ALL_RECS.STORM_RECORD_DESC
 203        ,ALL_RECS.STORM_START_DATETIME
 204        ,ALL_RECS.GLOBAL_ETR
 205        ,ALL_RECS.STORM_END_DATETIME
 206        FROM
 207        (
 208          SELECT
 209             DISTRICT
 210             ,MAX(LAST_MODIFIED_ON) AS LAST_MODIFIED_ON
 211           FROM
 212           (
 213            SELECT DISTINCT
 214             DB_USERNAME AS LAST_MODIFIED_BY
 215             ,CREATION_DATETIME AS LAST_MODIFIED_ON
 216             ,MAJOR_OUTAGE.MAJ_OTG_ID AS STORM_ID
 217             ,DECODE(MAJOR_OTG_DISTRICT.DIST_NO ,1,'1 - Queens, Nas.',2,'2 - Central, Nas.',3,'3 - Western, Suf.',4,'4 -
 217      ! Eastern, Suf.','UNKNOWN') AS DISTRICT
 218             ,MAJOR_OUTAGE.EVENT_NAME AS STORM_RECORD_DESC
 219             ,MAJOR_OUTAGE.START_DATETIME AS STORM_START_DATETIME
 220        
 221             ,CASE
 222              WHEN MAJOR_OUTAGE.EST_CLU_DATETIME IS NULL
 223                THEN 'DAMAGE_ASSESSMENT'
 224                ELSE TO_CHAR(MAJOR_OUTAGE.EST_CLU_DATETIME, 'MM/DD/YYYY HH24:MI:SS')
 225              END AS GLOBAL_ETR
 226        
 227             ,MAJOR_OUTAGE.END_DATETIME AS STORM_END_DATETIME
 228        
 229            FROM
 230            (
 231              SELECT
 232                SYSDATE
 233                ,A.AUDIT_CONFIG_TABLE_HEADER_ID
 234                ,A.TABLE_OWNER
 235                ,A.TABLE_NAME
 236                ,A.SQL_COMMAND
 237                ,A.PROGRAM_NAME
 238                ,A.WORKSTATION_NAME
 239                ,A.OS_USERNAME
 240                ,A.DB_USERNAME
 241                ,A.CREATION_DATETIME
 242        
 243                ,B.COLUMN_NAME
 244                ,NVL(B.OLD_VALUE, 'EMPTY') AS OLD_V
 245                ,NVL(B.NEW_VALUE, 'EMPTY') AS NEW_V
 246        
 247              FROM AUDIT_CONFIG_TABLE_HEADER@OMS_LINK.WORLD A
 248              LEFT JOIN AUDIT_CONFIG_TABLE_DETAIL@OMS_LINK.WORLD B ON A.AUDIT_CONFIG_TABLE_HEADER_ID =
 248      ! B.AUDIT_CONFIG_TABLE_HEADER_ID
 249              CROSS JOIN STORM_REPORTDATE
 250              WHERE
 251                (CREATION_DATETIME >= STORM_REPORTDATE.START_DATETIME) AND (CREATION_DATETIME <= STORM_REPORTDATE.END_DATETIME
 251      !  OR STORM_REPORTDATE.END_DATETIME IS NULL)
 252                AND TABLE_NAME = 'MAJOR_OUTAGE'
 253                AND COLUMN_NAME IN ('MAJ_OTG_ID')
 254                AND PROGRAM_NAME = 'IncMgr.exe'
 255                AND DB_USERNAME NOT IN ('M3I_STATMGR')
 256            )
 257        
 258            LEFT JOIN MAJOR_OUTAGE@OMS_LINK.WORLD ON NEW_V = MAJOR_OUTAGE.MAJ_OTG_ID
 259            LEFT JOIN MAJOR_OTG_DISTRICT@OMS_LINK.WORLD ON NEW_V = MAJOR_OTG_DISTRICT.MAJ_OTG_ID
 260        
 261            ORDER BY LAST_MODIFIED_ON, DISTRICT
 262           )
 263           GROUP BY
 264             DISTRICT
 265        ) LATEST_RECS
 266        
 267        INNER JOIN
 268        (
 269          SELECT DISTINCT
 270           DB_USERNAME AS LAST_MODIFIED_BY
 271           ,CREATION_DATETIME AS LAST_MODIFIED_ON
 272           ,MAJOR_OUTAGE.MAJ_OTG_ID AS STORM_ID
 273           ,DECODE(MAJOR_OTG_DISTRICT.DIST_NO ,1,'1 - Queens, Nas.',2,'2 - Central, Nas.',3,'3 - Western, Suf.',4,'4 -
 273      ! Eastern, Suf.','UNKNOWN') AS DISTRICT
 274           ,MAJOR_OUTAGE.EVENT_NAME AS STORM_RECORD_DESC
 275           ,MAJOR_OUTAGE.START_DATETIME AS STORM_START_DATETIME
 276        
 277           ,CASE
 278            WHEN MAJOR_OUTAGE.EST_CLU_DATETIME IS NULL
 279              THEN 'DAMAGE_ASSESSMENT'
 280              ELSE TO_CHAR(MAJOR_OUTAGE.EST_CLU_DATETIME, 'MM/DD/YYYY HH24:MI:SS')
 281            END AS GLOBAL_ETR
 282        
 283           ,MAJOR_OUTAGE.END_DATETIME AS STORM_END_DATETIME
 284        
 285          FROM
 286          (
 287            SELECT
 288              SYSDATE
 289              ,A.AUDIT_CONFIG_TABLE_HEADER_ID
 290              ,A.TABLE_OWNER
 291              ,A.TABLE_NAME
 292              ,A.SQL_COMMAND
 293              ,A.PROGRAM_NAME
 294              ,A.WORKSTATION_NAME
 295              ,A.OS_USERNAME
 296              ,A.DB_USERNAME
 297              ,A.CREATION_DATETIME
 298        
 299              ,B.COLUMN_NAME
 300              ,NVL(B.OLD_VALUE, 'EMPTY') AS OLD_V
 301              ,NVL(B.NEW_VALUE, 'EMPTY') AS NEW_V
 302        
 303            FROM AUDIT_CONFIG_TABLE_HEADER@OMS_LINK.WORLD A
 304            LEFT JOIN AUDIT_CONFIG_TABLE_DETAIL@OMS_LINK.WORLD B ON A.AUDIT_CONFIG_TABLE_HEADER_ID =
 304      ! B.AUDIT_CONFIG_TABLE_HEADER_ID
 305            CROSS JOIN STORM_REPORTDATE
 306            WHERE
 307              (CREATION_DATETIME >= STORM_REPORTDATE.START_DATETIME) AND (CREATION_DATETIME <= STORM_REPORTDATE.END_DATETIME
 307      ! OR STORM_REPORTDATE.END_DATETIME IS NULL)
 308              AND TABLE_NAME = 'MAJOR_OUTAGE'
 309              AND COLUMN_NAME IN ('MAJ_OTG_ID')
 310              AND PROGRAM_NAME = 'IncMgr.exe'
 311              AND DB_USERNAME NOT IN ('M3I_STATMGR')
 312        
 313          )
 314        
 315          LEFT JOIN MAJOR_OUTAGE@OMS_LINK.WORLD ON NEW_V = MAJOR_OUTAGE.MAJ_OTG_ID
 316          LEFT JOIN MAJOR_OTG_DISTRICT@OMS_LINK.WORLD ON NEW_V = MAJOR_OTG_DISTRICT.MAJ_OTG_ID
 317        
 318          ORDER BY LAST_MODIFIED_ON, DISTRICT
 319        ) ALL_RECS
 320        ON
 321          ALL_RECS.LAST_MODIFIED_ON = LATEST_RECS.LAST_MODIFIED_ON
 322          AND
 323          ALL_RECS.DISTRICT = LATEST_RECS.DISTRICT
 324        WHERE UPPER(LAST_MODIFIED_BY) NOT IN ('BALDASSAR', 'BALDASSARW', 'BENJAMINR', 'MORALESE', 'ALEXA', 'HUIEP', 'NORDJOD',
 324      !  'CARLUCCIN', 'CAYASM')
 325        ORDER BY ALL_RECS.DISTRICT
 326        
 327        );

 NOTE: Table WORK.STORM_SETTINGS_DASH created, with 0 rows and 8 columns.
 
 328        DISCONNECT FROM ORACLE;
 329        QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.68 seconds
       cpu time            0.02 seconds
       
 
 330        
 331        
 332        PROC SQL;
 333        CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan:1521/ohprd');
 334        /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 335        /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 336        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 336      ! */
 337        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 337      ! PROD 67 HN */
 338        EXECUTE
 339        (
 340        ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 341        ) BY ORACLE;
 342        CREATE TABLE WORK.QV_WTHRMULT_DASH AS
 343        SELECT * FROM CONNECTION TO ORACLE
 344        (
 345        SELECT
 346          DISTRICT.DIST_DESC
 347          ,CLIMATIC_COND.DURATION_MULTIPLIER
 348        
 349        FROM DISTRICT@OMS_LINK.WORLD
 350        LEFT JOIN CLIMATIC_COND@OMS_LINK.WORLD ON DISTRICT.CLIMATIC_CD = CLIMATIC_COND.CLIMATIC_CD
 351        ORDER BY DIST_NO
 352        );
 NOTE: Table WORK.QV_WTHRMULT_DASH created, with 4 rows and 2 columns.
 
 353        DISCONNECT FROM ORACLE;
 354        QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.22 seconds
       cpu time            0.01 seconds
       
 
 355        
 356        
 357        
 358        PROC SQL;
 359           CREATE TABLE WORK.QV_GLOBALETR_DASH AS
 360           SELECT
 361             t1.DISTRICT,
 362             t1.STORM_START_DATETIME FORMAT=NLDATML20. AS START_DATETIME,
 363             t1.GLOBAL_ETR,
 364             t1.STORM_END_DATETIME FORMAT=NLDATML20. AS END_DATETIME
 365        
 366              FROM WORK.STORM_SETTINGS_DASH t1;
 NOTE: Table WORK.QV_GLOBALETR_DASH created, with 0 rows and 4 columns.
 
 367        QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 368        
 369        
 370        PROC SQL;
 371        CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 372        /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 373        /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 374        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 374      ! */
 375        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P');*/ /* #CONNECT TO PROD
 375      !  67 HN */
 376        EXECUTE
 377        (
 378        ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 379        ) BY ORACLE;
 380        CREATE TABLE WORK.GETSTORMDATES AS
 381        SELECT * FROM CONNECTION TO ORACLE
 382        (
 383        SELECT
 384            TO_DATE(TRUNC(SYSDATE) - 10, 'MM/DD/YYYY HH24:MI:SS') AS "START_DATETIME"
 385            ,'.' AS "END_DATETIME"
 386        FROM DUAL
 387        );
 NOTE: Table WORK.GETSTORMDATES created, with 1 rows and 2 columns.
 

 388        DISCONNECT FROM ORACLE;
 389        QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.16 seconds
       cpu time            0.02 seconds
       
 
 390        
 391        
 392        PROC SQL;
 393           CREATE TABLE WORK.qryGetStormDates AS
 394           SELECT t1.START_DATETIME FORMAT=NLDATML20. AS START_DATETIME
 395                  ,t1.END_DATETIME AS END_DATETIME
 396              FROM WORK.GETSTORMDATES t1;
 NOTE: Table WORK.QRYGETSTORMDATES created, with 1 rows and 2 columns.
 
 397        QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 398        
 399        
 400        proc sql noprint;
 401        select START_DATETIME into :var from WORK.qryGetStormDates;
 402        quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 403        
 404        PROC SQL;
 405        CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 406        /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 407        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 407      ! */
 408        /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P');*/ /* #CONNECT TO PROD
 408      !  67 HN */
 409        EXECUTE
 410        (
 411        ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 412        ) BY ORACLE;
 413        CREATE TABLE WORK.V_ETR_SUMMARY_BASELINE_STORM AS
 414        SELECT * FROM CONNECTION TO ORACLE
 415        (
 416        /* SELECT * FROM V_ETR_SUMMARY_BASELINE_STORM */
 417        
 418        SELECT
 419          "DISTRICT"
 420          ,"CIRCT_NO"
 421          ,"VLG_TWN_CTY"
 422          ,"CREATION_DATETIME"
 423          ,"CREATION_INTERVAL"
 424          ,"ENERGT"
 425          ,"RESTORED_DURING_INTERVAL"
 426          ,"RESTORED_AS_OF_INTERVAL"
 427          ,"FINAL_ETR"
 428          ,"CAD_ID"
 429          ,"OMS_LOCATION_ADDR"
 430          ,"PARENT_JOB"
 431          ,"CALL_TYPE"
 432          ,"JOB_TYPE"
 433          ,"JOB_TYPE_DESC"
 434          ,"OUTAGE_PRIORITY"
 435          ,"REFERRED_TO"
 436          ,"OMS_LOCATION_ID"
 437          ,"TTL_CUST_OUT"
 438          ,"TTL_CALLS"
 439          ,"STOP_ETR_RECALC"
 440          ,"JOB_STATUS"
 441          ,"CREW_STATUS"
 442          ,NULL AS CREW_TYPE
 443          ,"LEAD_CREW"
 444          ,"CAUSE_DESC"
 445          ,"DAMAGE_DESC"
 446          ,"COMP_TYPE"
 447          ,INC_DEV_ROUTINE_FLAG
 448          ,"ISR_CAD_ID"
 449          ,"LEAD_CREW_STATUS"
 450          ,"CURRENT_TIME"
 451          ,"AGE_BY_CREATION_HRS_MIN_SEC"
 452          ,"AGE_BY_CREATION_MIN"
 453          ,"CREW_DISPATCHED_DATETIME"
 454          ,"AGE_BY_DISPATCHED_HRS_MIN_SEC"
 455          ,"AGE_BY_DISPATCH_MIN"
 456          ,"CREW_LAST_STATUS_DATETIME"
 457          ,"AGE_BY_LAST_STATUS_HRS_MIN_SEC"
 458          ,"AGE_BY_LAST_STATUS_MIN"
 459        
 460          ,(TRUNC(SYSDATE) - 10) AS "START_DATETIME"
 461          /* ,'.' AS "END_DATETIME" */
 462        FROM
 463        (
 464          SELECT
 465            "DISTRICT"
 466            ,"CIRCT_NO"
 467            ,"VLG_TWN_CTY"
 468            ,"CREATION_DATETIME"
 469            ,"CREATION_INTERVAL"
 470            ,"ENERGT"
 471            ,"RESTORED_DURING_INTERVAL"
 472            ,"RESTORED_AS_OF_INTERVAL"
 473            ,"FINAL_ETR"
 474            ,"CAD_ID"
 475            ,"OMS_LOCATION_ADDR"
 476            ,"PARENT_JOB"
 477            ,"CALL_TYPE"
 478            ,"JOB_TYPE"
 479            ,"JOB_TYPE_DESC"
 480            ,"OUTAGE_PRIORITY"
 481            ,"REFERRED_TO"
 482            ,"OMS_LOCATION_ID"
 483            ,"TTL_CUST_OUT"
 484            ,"TTL_CALLS"
 485            ,"STOP_ETR_RECALC"
 486            ,"JOB_STATUS"
 487            ,"CREW_STATUS"
 488            ,"LEAD_CREW"
 489            ,"CAUSE_DESC"
 490            ,"DAMAGE_DESC"
 491            ,"COMP_TYPE"
 492            ,"ISR_CAD_ID"
 493            ,"LEAD_CREW_STATUS"
 494            ,"CURRENT_TIME"
 495            ,"AGE_BY_CREATION_HRS_MIN_SEC"
 496            ,"AGE_BY_CREATION_MIN"
 497            ,"CREW_DISPATCHED_DATETIME"
 498            ,"AGE_BY_DISPATCHED_HRS_MIN_SEC"
 499            ,"AGE_BY_DISPATCH_MIN"
 500            ,"CREW_LAST_STATUS_DATETIME"
 501            ,"AGE_BY_LAST_STATUS_HRS_MIN_SEC"
 502            ,"AGE_BY_LAST_STATUS_MIN"
 503            ,INC_DEV_ROUTINE_FLAG
 504          FROM
 505          (
 506            SELECT DISTINCT
 507              DISTRICT
 508              ,CIRCT_NO
 509              ,VILLAGE_NAME AS VLG_TWN_CTY
 510              ,CREATION_DATETIME
 511              ,TRUNC(CREATION_DATETIME,'dd') + (FLOOR(to_char(CREATION_DATETIME,'sssss')/3600)/24) AS CREATION_INTERVAL
 512              ,ENERGT
 513              ,TRUNC(ENERGT,'dd') + (FLOOR(to_char(ENERGT,'sssss')/3600)/24) AS RESTORED_DURING_INTERVAL
 514              ,TRUNC(ENERGT,'dd') + (CEIL(to_char(ENERGT,'sssss')/3600)/24) AS RESTORED_AS_OF_INTERVAL
 515              ,FINAL_ETR
 516              ,CAD_ID
 517              ,OMS_LOCATION_ADDR
 518              ,PARENT_JOB
 519        
 520              ,CASE
 521                WHEN (CALL_TYPE IN ('OUT') AND TTL_CUST_OUT = 0 AND ( ENERGT IS NULL OR (ROUND((24*60*60*(ENERGT -
 521      ! CREATION_DATETIME)),2) >= 300 AND ENERGT IS NOT NULL) ) AND INC_DEV_ROUTINE_FLAG = 'T')
 522                  THEN 'CANC'
 523                  ELSE CALL_TYPE
 524                END AS "CALL_TYPE"
 525        
 526              ,JOB_TYPE
 527              ,JOB_TYPE_DESC
 528              ,OUTAGE_PRIORITY
 529              ,REFERRED_TO
 530              ,OMS_LOCATION_ID
 531              ,TTl_CUST_OUT
 532              ,TTL_CALLS
 533              ,CASE
 534                WHEN STOP_ETR_RECALC = 'T'
 535                  THEN 'TRUE'
 536                  ELSE NULL
 537              END AS STOP_ETR_RECALC
 538              ,CASE
 539                WHEN
 540                  (
 541                    (UPPER(LEAD_CREW_STATUS) IN ('ACCEPTED', 'REPORTING', 'DISPATCHED') OR (UPPER(LEAD_CREW_STATUS) LIKE
 541      ! '%ROUTE') OR (UPPER(LEAD_CREW_STATUS) LIKE '%SITE%'))
 542                    AND (ENERGT IS NULL) AND (REFERRED_TO NOT IN ('PRE', 'LKP') OR REFERRED_TO IS NULL)
 543                  )
 544                  THEN 'DISPATCHED'
 545                WHEN ( UPPER(LEAD_CREW_STATUS) IN ('UNASSIGNED', 'RECEIVED', 'CLEARED') OR LEAD_CREW_STATUS IS NULL ) AND
 545      ! (ENERGT IS NULL) AND (REFERRED_TO NOT IN ('PRE', 'LKP') OR REFERRED_TO IS NULL)
 546                  THEN 'NOT_DISPATCHED'
 547                WHEN ENERGT IS NOT NULL
 548                  THEN 'ENERGIZED'
 549                WHEN REFERRED_TO IN ('PRE', 'LKP')
 550                  THEN 'SURVEY'
 551                WHEN CALL_TYPE IN ('EMER')
 552                  THEN 'NON_OUTAGE'
 553              END AS "JOB_STATUS"
 554              ,CREW_STATUS
 555              ,LEAD_CREW
 556              ,CAUSE_DESC
 557              ,DAMAGE_DESC
 558              ,COMP_TYPE
 559        
 560              ,ISR_CAD_ID
 561              ,LEAD_CREW_STATUS
 562              ,SYSDATE AS CURRENT_TIME
 563        
 564              ,LPAD(TO_CHAR(EXTRACT(DAY FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') - to_timestamp(CREATION_DATETIME,
 564      !  'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 565              || ':'
 566              || LPAD(TO_CHAR(EXTRACT(HOUR FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 566      ! to_timestamp(CREATION_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 567              || ':'
 568              || LPAD(TO_CHAR(EXTRACT (MINUTE FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 568      ! to_timestamp(CREATION_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 569              || ':'
 570              || LPAD(TO_CHAR(EXTRACT(SECOND FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 570      ! to_timestamp(CREATION_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 571              AS AGE_BY_CREATION_HRS_MIN_SEC
 572        
 573              ,ROUND(24*60*(TO_DATE(SYSDATE, 'MM/DD/YYYY HH24:MI:SS') - TO_DATE(CREATION_DATETIME, 'MM/DD/YYYY HH24:MI:SS')),
 573      ! 0) AS AGE_BY_CREATION_MIN
 574        
 575              ,CREW_DISPATCHED_DATETIME
 576              ,CASE
 577                WHEN CREW_DISPATCHED_DATETIME IS NOT NULL
 578                  THEN
 579                    LPAD(TO_CHAR(EXTRACT(DAY FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 579      ! to_timestamp(CREW_DISPATCHED_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 580                    || ':'
 581                    || LPAD(TO_CHAR(EXTRACT(HOUR FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 581      ! to_timestamp(CREW_DISPATCHED_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 582                    || ':'
 583                    || LPAD(TO_CHAR(EXTRACT (MINUTE FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 583      ! to_timestamp(CREW_DISPATCHED_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 584                    || ':'
 585                    || LPAD(TO_CHAR(EXTRACT(SECOND FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 585      ! to_timestamp(CREW_DISPATCHED_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 586                  ELSE NULL
 587              END AS AGE_BY_DISPATCHED_HRS_MIN_SEC
 588        
 589              ,ROUND(24*60*(TO_DATE(SYSDATE, 'MM/DD/YYYY HH24:MI:SS') - TO_DATE(CREW_DISPATCHED_DATETIME, 'MM/DD/YYYY
 589      ! HH24:MI:SS')), 0) AS AGE_BY_DISPATCH_MIN
 590        
 591              ,CREW_LAST_STATUS_DATETIME
 592              ,CASE
 593                WHEN CREW_LAST_STATUS_DATETIME IS NOT NULL
 594                  THEN
 595                    LPAD(TO_CHAR(EXTRACT(DAY FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 595      ! to_timestamp(CREW_LAST_STATUS_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 596                    || ':'
 597                    || LPAD(TO_CHAR(EXTRACT(HOUR FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 597      ! to_timestamp(CREW_LAST_STATUS_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 598                    || ':'
 599                    || LPAD(TO_CHAR(EXTRACT (MINUTE FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 599      ! to_timestamp(CREW_LAST_STATUS_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 600                    || ':'
 601                    || LPAD(TO_CHAR(EXTRACT(SECOND FROM (to_timestamp(SYSDATE, 'mm/dd/yyyy hh24:mi:ss') -
 601      ! to_timestamp(CREW_LAST_STATUS_DATETIME, 'mm/dd/yyyy hh24:mi:ss')))), 2,'0')
 602                  ELSE NULL
 603              END AS AGE_BY_LAST_STATUS_HRS_MIN_SEC
 604        
 605              ,ROUND(24*60*(TO_DATE(SYSDATE, 'MM/DD/YYYY HH24:MI:SS') - TO_DATE(CREW_LAST_STATUS_DATETIME, 'MM/DD/YYYY
 605      ! HH24:MI:SS')), 0) AS AGE_BY_LAST_STATUS_MIN
 606        
 607              ,INC_DEV_ROUTINE_FLAG
 608        
 609            FROM
 610            (
 611              SELECT
 612                LOC_DISTRICT AS DISTRICT
 613                ,CIRCUIT.CIRCT_NO
 614        
 615        
 616                ,INC.VILLAGE_NAME
 617        
 618                ,LOC_CREATION_DATETIME AS CREATION_DATETIME
 619                ,LOC_ENERGT AS ENERGT
 620                ,LOC_FINAL_ETR AS FINAL_ETR
 621                ,LOC_CAD_ID AS CAD_ID
 622                ,LOC_OMS_LOCATION_ADDR AS OMS_LOCATION_ADDR
 623                ,INC.PARENT_JOB
 624                ,CLUE.CLUE_CD AS JOB_TYPE
 625                ,CLUE.CALL_TYPE_CD AS CALL_TYPE
 626                ,CLUE.CLUE_DESC1 AS JOB_TYPE_DESC
 627                ,LOCATION_UDF.UDF24 AS OUTAGE_PRIORITY
 628                ,LOCATION_UDF.UDF10 AS REFERRED_TO
 629        
 630                ,LOC_OMS_LOCATION_ID AS OMS_LOCATION_ID
 631                ,INC.LOCATION_ID AS INC_LOCATION_ID
 632        
 633                ,LOC_TTl_CUST_OUT AS TTL_CUST_OUT
 634                ,LOC_TTL_CALLS AS TTL_CALLS
 635        
 636                ,LOC_STOP_ETR_RECALC AS STOP_ETR_RECALC
 637        
 638                ,FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_DESC AS CREW_STATUS
 639        
 640                ,CAD_LEAD_CREW AS LEAD_CREW
 641                ,INC.CAUSE_CODE AS CAUSE_CODE
 642                ,CAUSE.CAUSE_DESC AS CAUSE_DESC
 643        
 644                ,ISR_ISR_NO AS ISR_CAD_ID
 645                ,ISR_P_STATUS AS ISR_P_STATUS
 646                ,crew.DISPATCHED_DATETIME AS CREW_DISPATCHED_DATETIME
 647        
 648                ,CASE
 649                  WHEN ISR_HANDLING_UNIT IS NOT NULL
 650                    THEN ISR_LAST_STATUS_TIME
 651                    ELSE NULL
 652                END AS "CREW_LAST_STATUS_DATETIME"
 653        
 654                ,ISR_HANDLING_UNIT AS ISR_CREW
 655        
 656                ,CASE
 657                  WHEN UPPER(B07_STATUS.B07_DESCRIPTION) NOT IN ('RECEIVED') AND ISR_HANDLING_UNIT IS NOT NULL
 658                    THEN B07_STATUS.B07_DESCRIPTION
 659                    ELSE NULL
 660                END AS "LEAD_CREW_STATUS"
 661        
 662                ,PSEGLI_SPEC_ISR.UDF202 AS DAMAGE_DESC
 663                ,PSEGLI_SPEC_ISR.UDF2 AS COMP_TYPE
 664        
 665                ,INC_DEV_ROUTINE_FLAG
 666            FROM
 667            (
 668                SELECT
 669                  *
 670                FROM
 671                (
 672                  SELECT
 673                    PARENT_JOB
 674                    ,INCIDENT_ID
 675                    ,LOCATION_ID
 676                    ,TTL_CALLS
 677                    ,TTL_LOCATIONS
 678                    ,TTL_PRIORITY_CUSTOMERS
 679                    ,TTL_CUSTOMERS
 680                    ,TTL_CUSTOMERS_OUT
 681                    ,TTL_KVA_OUT
 682                    ,CREATION_DATETIME
 683                    ,CREW_STATUS_CODE
 684                    ,CAUSE_CODE
 685        
 686                    ,VILLAGE_NAME
 687        
 688        
 689                    ,INC_DEV_INCIDENT_DEVICE_ID
 690                    ,INC_DEV_INCIDENT_ID
 691                    ,INC_DEV_LOCATION_ID
 692                    ,INC_DEV_PRIMARY_INC_DEV_FLG
 693                    ,INC_DEV_ROUTINE_FLAG
 694        
 695                    ,LOC_DISTRICT
 696                    ,LOC_CREATION_DATETIME
 697                    ,LOC_ENERGT
 698                    ,LOC_FINAL_ETR
 699                    ,LOC_CAD_ID
 700                    ,LOC_OMS_LOCATION_ADDR
 701                    ,LOC_OMS_LOCATION_ID
 702                    ,LOC_INCIDENT_ID
 703                    ,LOC_TTl_CUST_OUT
 704                    ,LOC_TTL_CALLS
 705                    ,LOC_STOP_ETR_RECALC
 706                    ,LOC_FAC_JOB_STATUS_CD
 707                    ,LOC_INCIDENT_DEVICE_ID
 708        
 709                  FROM
 710                  (
 711                    SELECT
 712                      INCIDENT.CMPLX_CAD_ID AS PARENT_JOB
 713                      ,INCIDENT.INCIDENT_ID AS INCIDENT_ID
 714                      ,INCIDENT.LOCATION_ID AS LOCATION_ID
 715                      ,INCIDENT.CALL_QTY_TOTAL AS TTL_CALLS
 716                      ,INCIDENT.LOC_QTY_TOTAL AS TTL_LOCATIONS
 717                      ,INCIDENT.DOWNSTREAM_PRICUST_QTY_TOTAL AS TTL_PRIORITY_CUSTOMERS
 718                      ,INCIDENT.DOWNSTREAM_CUST_QTY_TOTAL AS TTL_CUSTOMERS
 719                      ,INCIDENT.DOWNSTREAM_OUT_CUST_QTY AS TTL_CUSTOMERS_OUT
 720                      ,INCIDENT.DOWNSTREAM_KVA_VAL_TOTAL AS TTL_KVA_OUT
 721                      ,INCIDENT.CREATION_DATETIME AS CREATION_DATETIME
 722                      ,INCIDENT.FAC_JOB_STATUS_CD AS CREW_STATUS_CODE
 723                      ,INCIDENT.CAUSE_CD AS CAUSE_CODE
 724        
 725                      ,INCIDENT.CITY_NAM AS VILLAGE_NAME
 726        
 727                    FROM INCIDENT@OMS_LINK.WORLD
 728                    WHERE
 729                      TRUNC(INCIDENT.CREATION_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE)
 730                      AND INCIDENT.FAC_JOB_STATUS_CD NOT IN ('Z')
 731        
 732                      AND
 733        
 734                      INCIDENT.INCIDENT_ID NOT IN
 735                      (
 736                        SELECT
 737                          incident_id
 738                        FROM
 739                        (
 740                          SELECT
 741                            '1-inc'
 742                           ,incident_id
 743                           ,location_id
 744                           ,null as "incident_device_id"
 745                           ,null
 746                           ,null
 747                           ,NULL
 748                           ,NULL
 749                           ,NULL
 750                           ,NULL
 751                           ,NULL
 752                          FROM incident@OMS_LINK.WORLD
 753                          WHERE incident_id in (select distinct incident_id from location@OMS_LINK.WORLD where
 753      ! incident_device_id not in (select incident_device_id from incident_device@OMS_LINK.WORLD ))
 754                        )
 755                      )
 756        
 757                      ORDER BY INCIDENT.INCIDENT_ID
 758                  )
 759        
 760                LEFT JOIN
 761                (
 762                  SELECT
 763                    DECODE(LOC.DIST_NO,1,'1 - Queens, Nas.',2,'2 - Central, Nas.',3,'3 - Western, Suf.',4,'4 - Eastern,
 763      ! Suf.','UNKNOWN') as LOC_DISTRICT
 764                    ,LOC.CREATION_DATETIME AS LOC_CREATION_DATETIME
 765                    ,LOC.ENERGIZED_DATETIME AS LOC_ENERGT
 766                    ,LOC.ETR_DATETIME AS LOC_FINAL_ETR
 767                    ,LOC.CAD_ID AS LOC_CAD_ID
 768                    ,LOC.LOC_DESC AS LOC_OMS_LOCATION_ADDR
 769                    ,LOC.LOCATION_ID AS LOC_OMS_LOCATION_ID
 770                    ,LOC.INCIDENT_ID AS LOC_INCIDENT_ID
 771                    ,LOC.DOWNSTREAM_CUST_QTY_TOTAL AS LOC_TTl_CUST_OUT
 772                    ,LOC.CALL_QTY_TOTAL AS LOC_TTL_CALLS
 773                    ,LOC.STOP_ETR_RECALC_FLG AS LOC_STOP_ETR_RECALC
 774                    ,LOC.FAC_JOB_STATUS_CD AS LOC_FAC_JOB_STATUS_CD
 775                    ,LOC.INCIDENT_DEVICE_ID AS LOC_INCIDENT_DEVICE_ID
 776                    FROM LOCATION@OMS_LINK.WORLD LOC
 777                    WHERE
 778        
 779                    TRUNC(CREATION_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE)
 780        
 781                    ORDER BY CAD_ID
 782                  ) LOC
 783                  ON
 784                  INCIDENT_ID = LOC.LOC_INCIDENT_ID
 785        
 786                LEFT JOIN
 787                (
 788                  SELECT
 789                    INCIDENT_DEVICE_ID AS INC_DEV_INCIDENT_DEVICE_ID
 790                    ,INCIDENT_ID AS INC_DEV_INCIDENT_ID
 791                    ,LOCATION_ID AS INC_DEV_LOCATION_ID
 792                    ,PRIMARY_INC_DEV_FLG AS INC_DEV_PRIMARY_INC_DEV_FLG
 793                    ,ROUTINE_FLG AS INC_DEV_ROUTINE_FLAG
 794                  FROM INCIDENT_DEVICE@OMS_LINK.WORLD
 795                  WHERE
 796                    PRIMARY_INC_DEV_FLG = 'T'
 797        
 798                    AND TRUNC(CREATION_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE)
 799                ) INC_DEV
 800                ON
 801                LOC.LOC_INCIDENT_ID = INC_DEV_INCIDENT_ID
 802                AND
 803                LOC.LOC_OMS_LOCATION_ID = INC_DEV_LOCATION_ID
 804                AND
 805                LOC.LOC_INCIDENT_DEVICE_ID = INC_DEV_INCIDENT_DEVICE_ID
 806        
 807              )INC
 808              )INC
 809        
 810              LEFT JOIN FAC_JOB_STATUS_DEF@OMS_LINK.WORLD ON INC.LOC_FAC_JOB_STATUS_CD = FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_CD
 811              LEFT JOIN LOCATION_UDF@OMS_LINK.WORLD ON INC.LOCATION_ID = LOCATION_UDF.LOCATION_ID
 812              LEFT JOIN INCIDENT_DEVICE@OMS_LINK.WORLD ON LOC_INCIDENT_DEVICE_ID = INCIDENT_DEVICE.INCIDENT_DEVICE_ID
 813        
 814              /*
 815              LEFT JOIN
 816              (
 817                SELECT DISTINCT
 818                    MIN(PREMISE_CUSTNO_ID) OVER (PARTITION BY INCIDENT_DEVICE_ID, LOCATION_ID, INCIDENT_ID, CREATION_DATETIME
 818      ! ORDER BY INCIDENT_DEVICE_ID, LOCATION_ID, INCIDENT_ID, CREATION_DATETIME) AS ACCT
 819                    ,INCIDENT_DEVICE_ID AS IDP_INCIDENT_DEVICE_ID
 820                    ,LOCATION_ID
 821                    ,INCIDENT_ID
 822                    ,CREATION_DATETIME
 823                FROM INCIDENT_DEVICE_PREMISE@OMS_LINK.WORLD IDP
 824              ) IDP
 825              ON INCIDENT_DEVICE.INCIDENT_DEVICE_ID = IDP.IDP_INCIDENT_DEVICE_ID
 826              LEFT JOIN PREMISE_UDF ON IDP.ACCT = PREMISE_UDF.PREMISE_CUSTNO_ID
 827              */
 828        
 829              LEFT JOIN CLUE@OMS_LINK.WORLD ON INCIDENT_DEVICE.CLUE_CD = CLUE.CLUE_CD
 830              LEFT JOIN CIRCUIT@OMS_LINK.WORLD ON INCIDENT_DEVICE.CIRCT_ID = CIRCUIT.CIRCT_ID
 831              LEFT JOIN FAC_JOB_STATUS_DEF@OMS_LINK.WORLD ON INC.CREW_STATUS_CODE = FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_CD
 832        
 833              LEFT JOIN
 834              (
 835                SELECT
 836                  CAD.ISR_NO AS CAD_ISR_NO
 837                  ,CAD.CREATED_DATETIME AS CAD_CREATED_DATETIME
 838                  ,CAD.HANDLING_UNIT AS CAD_LEAD_CREW
 839                FROM ISR@CAD_LINK.WORLD CAD
 840                WHERE
 841                AGENCY_CODE = 'ESD'
 842        
 843                AND
 844                TRUNC(CREATED_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE + 1)
 845                ORDER BY CREATED_DATETIME
 846              ) CAD
 847              ON
 848              LOC_CAD_ID = CAD.CAD_ISR_NO
 849        
 850        
 851        
 852              LEFT JOIN
 853              (
 854                SELECT
 855                  ISR.ISR_NO AS ISR_ISR_NO
 856                  ,ISR.P_STATUS AS ISR_P_STATUS
 857        
 858                  ,TO_CHAR(FROM_TZ( CAST( ISR.STATUS_DATETIME AS TIMESTAMP ), 'UTC' ) AT LOCAL, 'MM/DD/YYYY HH24:MI:SS') AS
 858      ! ISR_LAST_STATUS_TIME
 859                  ,ISR.HANDLING_UNIT AS ISR_HANDLING_UNIT
 860        
 861                FROM ISR@CAD_LINK.WORLD
 862              ) ISR
 863              ON
 864              LOC_CAD_ID = ISR_ISR_NO
 865        
 866              LEFT JOIN B07_STATUS@CAD_LINK.WORLD ON ISR_P_STATUS = B07_STATUS.B07_STATUS_CODE
 867        
 868              LEFT JOIN CAUSE@OMS_LINK.WORLD ON INC.CAUSE_CODE = CAUSE.CAUSE_CD
 869        
 870              LEFT JOIN PSEGLI_SPEC_ISR@CAD_LINK.WORLD ON LOC_CAD_ID = ISR_NO
 871        
 872        
 873        
 874        
 875        
 876              LEFT JOIN
 877              (
 878                SELECT
 879                  "LOCATION_ID"
 880                  ,"CREW_NO"
 881                  ,FOREMAN_NAM
 882                  ,"'Dispatched'_DATE_TIME" AS DISPATCHED_DATETIME
 883                  ,"'Accepted'_DATE_TIME" AS ACCEPTED_DATETIME
 884                  ,"'En Route'_DATE_TIME" AS EN_ROUTE_DATETIME
 885                  ,"'On Site'_DATE_TIME" AS ON_SITE_DATETIME
 886                  ,"'Reporting'_DATE_TIME" AS REPORTING_DATETIME
 887                  ,"'Cleared'_DATE_TIME" AS CLEARED_DATETIME
 888                  ,"'Unassigned'_DATE_TIME" AS UNASSIGNED_DATETIME
 889                  FROM
 890                  (
 891                    SELECT
 892        
 893                      CREW_ACT.LOCATION_ID
 894                      ,CREW_ACT.CREW_NO
 895                      ,CREW_ACT.FOREMAN_NAM
 896        
 897                      ,CREWSTAT.STATUS_DATETIME AS DATE_TIME
 898        
 899                      ,FAC_JOB_STATUS_DESC AS CREW_STATUS
 900                    FROM
 901                    (
 902                      SELECT
 903                        CREW_ACT.CREW_ACTION_ID
 904        
 905                        ,CREW_ACT.LOCATION_ID
 906                        ,CREW_ACT.CREW_NO
 907                        ,CREW_ACT.FOREMAN_NAM
 908                      FROM CREW_ACTION@OMS_LINK.WORLD CREW_ACT
 909                      WHERE
 910                        LEAD_CREW_FLG = 'T'
 911                    ) CREW_ACT
 912        
 913                    LEFT JOIN CREW_STATUS@OMS_LINK.WORLD CREWSTAT ON CREW_ACT.CREW_ACTION_ID = CREWSTAT.CREW_ACTION_ID
 914        
 915                    LEFT JOIN FAC_JOB_STATUS_DEF@OMS_LINK.WORLD ON CREWSTAT.STATUS_CD = FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_CD
 916                  )
 917        
 918                  PIVOT
 919                  (
 920                    MAX(DATE_TIME) AS DATE_TIME
 921                    FOR CREW_STATUS IN ('Dispatched','Accepted','En Route','On Site','Reporting','Cleared','Unassigned')
 922                  )
 923        
 924              ) crew
 925              ON
 926              LOC_OMS_LOCATION_ID = crew.LOCATION_ID
 927              AND
 928              CAD_LEAD_CREW = crew.CREW_NO
 929        
 930        
 931        
 932        
 933        
 934        
 935        
 936            /* ***************************************************************************** */
 937            /* ***************************************************************************** */
 938            UNION ALL
 939            /* ***************************************************************************** */
 940            /* ***************************************************************************** */
 941        
 942        
 943            SELECT
 944                DISTRICT
 945                ,CIRCT_NO
 946        
 947                ,VILLAGE_NAME
 948        
 949                ,CREATION_DATETIME
 950                ,ENERGT
 951                ,FINAL_ETR
 952                ,CAD_ID
 953                ,OMS_LOCATION_ADDR
 954                ,PARENT_JOB
 955                ,JOB_TYPE
 956                ,CALL_TYPE
 957                ,JOB_TYPE_DESC
 958                ,OUTAGE_PRIORITY
 959                ,REFERRED_TO
 960        
 961                ,OMS_LOCATION_ID
 962                ,INC_LOCATION_ID
 963        
 964                ,TTL_CUST_OUT
 965                ,TTL_CALLS
 966        
 967                ,STOP_ETR_RECALC
 968        
 969                ,CREW_STATUS
 970        
 971                ,LEAD_CREW
 972                ,CAUSE_CODE
 973                ,CAUSE_DESC
 974        
 975                ,ISR_CAD_ID
 976                ,ISR_P_STATUS AS ISR_P_STATUS
 977                ,CREW_DISPATCHED_DATETIME
 978        
 979                ,CASE
 980                  WHEN ISR_CREW IS NOT NULL
 981                    THEN CREW_LAST_STATUS_DATETIME
 982                    ELSE NULL
 983                END AS "CREW_LAST_STATUS_DATETIME"
 984        
 985                ,ISR_CREW
 986        
 987                ,CASE
 988                  WHEN UPPER(LEAD_CREW_STATUS) NOT IN ('RECEIVED') AND ISR_CREW IS NOT NULL
 989                    THEN LEAD_CREW_STATUS
 990                    ELSE NULL
 991                END AS "LEAD_CREW_STATUS"
 992        
 993                ,DAMAGE_DESC
 994                ,COMP_TYPE
 995                ,INC_DEV_ROUTINE_FLAG
 996              FROM
 997              (
 998              SELECT
 999                LOC_DISTRICT AS DISTRICT
 1000               ,CIRCUIT.CIRCT_NO
 1001               ,INC.VILLAGE_NAME
 1002       
 1003               ,LOC_CREATION_DATETIME AS CREATION_DATETIME
 1004               ,LOC_ENERGT AS ENERGT
 1005               ,LOC_FINAL_ETR AS FINAL_ETR
 1006               ,LOC_CAD_ID AS CAD_ID
 1007               ,LOC_OMS_LOCATION_ADDR AS OMS_LOCATION_ADDR
 1008               ,INC.PARENT_JOB
 1009               ,CLUE.CLUE_CD AS JOB_TYPE
 1010               ,CLUE.CALL_TYPE_CD AS CALL_TYPE
 1011               ,CLUE.CLUE_DESC1 AS JOB_TYPE_DESC
 1012               ,HIS_LOCATION_UDF.UDF24 AS OUTAGE_PRIORITY
 1013               ,HIS_LOCATION_UDF.UDF10 AS REFERRED_TO
 1014       
 1015               ,LOC_OMS_LOCATION_ID AS OMS_LOCATION_ID
 1016               ,INC.LOCATION_ID AS INC_LOCATION_ID
 1017       
 1018               ,LOC_TTl_CUST_OUT AS TTL_CUST_OUT
 1019               ,LOC_TTL_CALLS AS TTL_CALLS
 1020       
 1021               ,LOC_STOP_ETR_RECALC AS STOP_ETR_RECALC
 1022       
 1023               ,FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_DESC AS CREW_STATUS
 1024       
 1025               ,CAD_LEAD_CREW AS LEAD_CREW
 1026               ,INC.CAUSE_CODE AS CAUSE_CODE
 1027               ,CAUSE.CAUSE_DESC AS CAUSE_DESC
 1028       
 1029               ,ISR_ISR_NO AS ISR_CAD_ID
 1030               ,ISR_P_STATUS AS ISR_P_STATUS
 1031               ,crew.DISPATCHED_DATETIME AS CREW_DISPATCHED_DATETIME
 1032               ,ISR_LAST_STATUS_TIME AS CREW_LAST_STATUS_DATETIME
 1033               ,ISR_HANDLING_UNIT AS ISR_CREW
 1034               ,B07_STATUS.B07_DESCRIPTION AS LEAD_CREW_STATUS
 1035               ,PSEGLI_SPEC_ISR.UDF202 AS DAMAGE_DESC
 1036               ,PSEGLI_SPEC_ISR.UDF2 AS COMP_TYPE
 1037       
 1038               ,INC_DEV_ROUTINE_FLAG
 1039             FROM
 1040             (
 1041               SELECT
 1042                 *
 1043               FROM
 1044               (
 1045                 SELECT
 1046                   PARENT_JOB
 1047                   ,INCIDENT_ID
 1048                   ,LOCATION_ID
 1049                   ,TTL_CALLS
 1050                   ,TTL_LOCATIONS
 1051                   ,TTL_PRIORITY_CUSTOMERS
 1052                   ,TTL_CUSTOMERS
 1053                   ,TTL_CUSTOMERS_OUT
 1054                   ,TTL_KVA_OUT
 1055                   ,CREATION_DATETIME
 1056                   ,CREW_STATUS_CODE
 1057                   ,CAUSE_CODE
 1058       
 1059                   ,VILLAGE_NAME
 1060       
 1061       
 1062                   ,INC_DEV_INCIDENT_DEVICE_ID
 1063                   ,INC_DEV_INCIDENT_ID
 1064                   ,INC_DEV_LOCATION_ID
 1065                   ,INC_DEV_PRIMARY_INC_DEV_FLG
 1066                   ,INC_DEV_ROUTINE_FLAG
 1067       
 1068                   ,LOC_DISTRICT
 1069                   ,LOC_CREATION_DATETIME
 1070                   ,LOC_ENERGT
 1071                   ,LOC_FINAL_ETR
 1072                   ,LOC_CAD_ID
 1073                   ,LOC_OMS_LOCATION_ADDR
 1074                   ,LOC_OMS_LOCATION_ID
 1075                   ,LOC_INCIDENT_ID
 1076                   ,LOC_TTl_CUST_OUT
 1077                   ,LOC_TTL_CALLS
 1078                   ,LOC_STOP_ETR_RECALC
 1079                   ,LOC_FAC_JOB_STATUS_CD
 1080                   ,LOC_INCIDENT_DEVICE_ID
 1081       
 1082                 FROM
 1083                 (
 1084                   SELECT
 1085                     HIS_INCIDENT.CMPLX_CAD_ID AS PARENT_JOB
 1086                     ,HIS_INCIDENT.INCIDENT_ID AS INCIDENT_ID
 1087                     ,HIS_INCIDENT.LOCATION_ID AS LOCATION_ID
 1088                     ,HIS_INCIDENT.CALL_QTY_TOTAL AS TTL_CALLS
 1089                     ,HIS_INCIDENT.LOC_QTY_TOTAL AS TTL_LOCATIONS
 1090                     ,HIS_INCIDENT.DOWNSTREAM_PRICUST_QTY_TOTAL AS TTL_PRIORITY_CUSTOMERS
 1091                     ,HIS_INCIDENT.DOWNSTREAM_CUST_QTY_TOTAL AS TTL_CUSTOMERS
 1092                     ,HIS_INCIDENT.DOWNSTREAM_OUT_CUST_QTY AS TTL_CUSTOMERS_OUT
 1093                     ,HIS_INCIDENT.DOWNSTREAM_KVA_VAL_TOTAL AS TTL_KVA_OUT
 1094                     ,HIS_INCIDENT.CREATION_DATETIME AS CREATION_DATETIME
 1095                     ,HIS_INCIDENT.FAC_JOB_STATUS_CD AS CREW_STATUS_CODE
 1096                     ,HIS_INCIDENT.CAUSE_CD AS CAUSE_CODE
 1097       
 1098                     ,HIS_INCIDENT.CITY_NAM AS VILLAGE_NAME
 1099       
 1100                   FROM HIS_INCIDENT@OMS_LINK.WORLD
 1101                   WHERE
 1102                     TRUNC(HIS_INCIDENT.CREATION_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE)
 1103                     AND HIS_INCIDENT.FAC_JOB_STATUS_CD NOT IN ('Z')
 1104       
 1105                     ORDER BY HIS_INCIDENT.INCIDENT_ID
 1106                 )
 1107       
 1108               LEFT JOIN
 1109               (
 1110                 SELECT
 1111                   DECODE(LOC.DIST_NO,1,'1 - Queens, Nas.',2,'2 - Central, Nas.',3,'3 - Western, Suf.',4,'4 - Eastern,
 1111     ! Suf.','UNKNOWN') as LOC_DISTRICT
 1112                   ,LOC.CREATION_DATETIME AS LOC_CREATION_DATETIME
 1113                   ,LOC.ENERGIZED_DATETIME AS LOC_ENERGT
 1114                   ,LOC.ETR_DATETIME AS LOC_FINAL_ETR
 1115                   ,LOC.CAD_ID AS LOC_CAD_ID
 1116                   ,LOC.LOC_DESC AS LOC_OMS_LOCATION_ADDR
 1117                   ,LOC.LOCATION_ID AS LOC_OMS_LOCATION_ID
 1118                   ,LOC.INCIDENT_ID AS LOC_INCIDENT_ID
 1119                   ,LOC.DOWNSTREAM_CUST_QTY_TOTAL AS LOC_TTl_CUST_OUT
 1120                   ,LOC.CALL_QTY_TOTAL AS LOC_TTL_CALLS
 1121                   ,LOC.STOP_ETR_RECALC_FLG AS LOC_STOP_ETR_RECALC
 1122                   ,LOC.FAC_JOB_STATUS_CD AS LOC_FAC_JOB_STATUS_CD
 1123                   ,LOC.INCIDENT_DEVICE_ID AS LOC_INCIDENT_DEVICE_ID
 1124                   FROM HIS_LOCATION@OMS_LINK.WORLD LOC
 1125                   WHERE
 1126       
 1127                   TRUNC(CREATION_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE)
 1128       
 1129                   ORDER BY CAD_ID
 1130                 ) LOC
 1131                 ON
 1132                 INCIDENT_ID = LOC.LOC_INCIDENT_ID
 1133       
 1134               LEFT JOIN
 1135               (
 1136                 SELECT
 1137                   INCIDENT_DEVICE_ID AS INC_DEV_INCIDENT_DEVICE_ID
 1138                   ,INCIDENT_ID AS INC_DEV_INCIDENT_ID
 1139                   ,LOCATION_ID AS INC_DEV_LOCATION_ID
 1140                   ,PRIMARY_INC_DEV_FLG AS INC_DEV_PRIMARY_INC_DEV_FLG
 1141                   ,ROUTINE_FLG AS INC_DEV_ROUTINE_FLAG
 1142                 FROM HIS_INCIDENT_DEVICE@OMS_LINK.WORLD
 1143                 WHERE
 1144                   PRIMARY_INC_DEV_FLG = 'T'
 1145       
 1146                   AND TRUNC(CREATION_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE)
 1147               ) INC_DEV
 1148               ON
 1149               LOC.LOC_INCIDENT_ID = INC_DEV_INCIDENT_ID
 1150               AND
 1151               LOC.LOC_OMS_LOCATION_ID = INC_DEV_LOCATION_ID
 1152               AND
 1153               LOC.LOC_INCIDENT_DEVICE_ID = INC_DEV_INCIDENT_DEVICE_ID
 1154       
 1155             )INC
 1156             )INC
 1157       
 1158             LEFT JOIN FAC_JOB_STATUS_DEF@OMS_LINK.WORLD ON INC.LOC_FAC_JOB_STATUS_CD = FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_CD
 1159             LEFT JOIN HIS_LOCATION_UDF@OMS_LINK.WORLD ON INC.LOCATION_ID = HIS_LOCATION_UDF.LOCATION_ID
 1160             LEFT JOIN HIS_INCIDENT_DEVICE@OMS_LINK.WORLD ON LOC_INCIDENT_DEVICE_ID = HIS_INCIDENT_DEVICE.INCIDENT_DEVICE_ID
 1161       
 1162             /*
 1163             LEFT JOIN
 1164             (
 1165               SELECT DISTINCT
 1166                   MIN(PREMISE_CUSTNO_ID) OVER (PARTITION BY INCIDENT_DEVICE_ID, LOCATION_ID, INCIDENT_ID, CREATION_DATETIME
 1166     ! ORDER BY INCIDENT_DEVICE_ID, LOCATION_ID, INCIDENT_ID, CREATION_DATETIME) AS ACCT
 1167                   ,INCIDENT_DEVICE_ID AS IDP_INCIDENT_DEVICE_ID
 1168                   ,LOCATION_ID
 1169                   ,INCIDENT_ID
 1170                   ,CREATION_DATETIME
 1171               FROM INCIDENT_DEVICE_PREMISE@OMS_LINK.WORLD IDP
 1172             ) IDP
 1173             ON INCIDENT_DEVICE.INCIDENT_DEVICE_ID = IDP.IDP_INCIDENT_DEVICE_ID
 1174             LEFT JOIN PREMISE_UDF ON IDP.ACCT = PREMISE_UDF.PREMISE_CUSTNO_ID
 1175             */
 1176       
 1177             LEFT JOIN CLUE@OMS_LINK.WORLD ON HIS_INCIDENT_DEVICE.CLUE_CD = CLUE.CLUE_CD
 1178             LEFT JOIN CIRCUIT@OMS_LINK.WORLD ON HIS_INCIDENT_DEVICE.CIRCT_ID = CIRCUIT.CIRCT_ID
 1179             LEFT JOIN FAC_JOB_STATUS_DEF@OMS_LINK.WORLD ON INC.CREW_STATUS_CODE = FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_CD
 1180       
 1181             LEFT JOIN
 1182             (
 1183               SELECT
 1184                 CAD.ISR_NO AS CAD_ISR_NO
 1185                 ,CAD.CREATED_DATETIME AS CAD_CREATED_DATETIME
 1186                 ,CAD.HANDLING_UNIT AS CAD_LEAD_CREW
 1187               FROM ISR@CAD_LINK.WORLD CAD
 1188               WHERE
 1189               AGENCY_CODE = 'ESD'
 1190       
 1191               AND
 1192               TRUNC(CREATED_DATETIME) BETWEEN TRUNC(SYSDATE - 10) AND TRUNC(SYSDATE + 1)
 1193               ORDER BY CREATED_DATETIME
 1194             ) CAD
 1195             ON
 1196             LOC_CAD_ID = CAD.CAD_ISR_NO
 1197       
 1198       
 1199             LEFT JOIN
 1200             (
 1201               SELECT
 1202                 ISR.ISR_NO AS ISR_ISR_NO
 1203                 ,ISR.P_STATUS AS ISR_P_STATUS
 1204                 ,TO_CHAR(FROM_TZ( CAST( ISR.STATUS_DATETIME AS TIMESTAMP ), 'UTC' ) AT LOCAL, 'MM/DD/YYYY HH24:MI:SS') AS
 1204     ! ISR_LAST_STATUS_TIME
 1205                 ,ISR.HANDLING_UNIT AS ISR_HANDLING_UNIT
 1206       
 1207               FROM ISR@CAD_LINK.WORLD
 1208             ) HIS_ISR
 1209             ON
 1210             LOC_CAD_ID = ISR_ISR_NO
 1211       
 1212             LEFT JOIN B07_STATUS@CAD_LINK.WORLD ON ISR_P_STATUS = B07_STATUS.B07_STATUS_CODE
 1213       
 1214             LEFT JOIN CAUSE@OMS_LINK.WORLD ON INC.CAUSE_CODE = CAUSE.CAUSE_CD
 1215       
 1216             LEFT JOIN PSEGLI_SPEC_ISR@CAD_LINK.WORLD ON LOC_CAD_ID = ISR_NO
 1217       
 1218       
 1219       
 1220       
 1221       
 1222       
 1223             LEFT JOIN
 1224             (
 1225               SELECT
 1226                 "LOCATION_ID"
 1227                 ,"CREW_NO"
 1228                 ,FOREMAN_NAM
 1229                 ,"'Dispatched'_DATE_TIME" AS DISPATCHED_DATETIME
 1230                 ,"'Accepted'_DATE_TIME" AS ACCEPTED_DATETIME
 1231                 ,"'En Route'_DATE_TIME" AS EN_ROUTE_DATETIME
 1232                 ,"'On Site'_DATE_TIME" AS ON_SITE_DATETIME
 1233                 ,"'Reporting'_DATE_TIME" AS REPORTING_DATETIME
 1234                 ,"'Cleared'_DATE_TIME" AS CLEARED_DATETIME
 1235                 ,"'Unassigned'_DATE_TIME" AS UNASSIGNED_DATETIME
 1236                 FROM
 1237                 (
 1238                   SELECT
 1239                     CREW_ACT.LOCATION_ID
 1240                     ,CREW_ACT.CREW_NO
 1241                     ,CREW_ACT.FOREMAN_NAM
 1242       
 1243                     ,CREWSTAT.STATUS_DATETIME AS DATE_TIME
 1244       
 1245                     ,FAC_JOB_STATUS_DESC AS CREW_STATUS
 1246                   FROM
 1247                   (
 1248                     SELECT
 1249                       CREW_ACT.CREW_ACTION_ID
 1250       
 1251                       ,CREW_ACT.LOCATION_ID
 1252                       ,CREW_ACT.CREW_NO
 1253                       ,CREW_ACT.FOREMAN_NAM
 1254                     FROM HIS_CREW_ACTION@OMS_LINK.WORLD CREW_ACT
 1255                     WHERE
 1256                       LEAD_CREW_FLG = 'T'
 1257                   ) CREW_ACT
 1258       
 1259                   LEFT JOIN HIS_CREW_STATUS@OMS_LINK.WORLD CREWSTAT ON CREW_ACT.CREW_ACTION_ID = CREWSTAT.CREW_ACTION_ID
 1260       
 1261                   LEFT JOIN FAC_JOB_STATUS_DEF@OMS_LINK.WORLD ON CREWSTAT.STATUS_CD = FAC_JOB_STATUS_DEF.FAC_JOB_STATUS_CD
 1262                 )
 1263       
 1264                 PIVOT
 1265                 (
 1266                   MAX(DATE_TIME) AS DATE_TIME
 1267                   FOR CREW_STATUS IN ('Dispatched','Accepted','En Route','On Site','Reporting','Cleared','Unassigned')
 1268                 )
 1269       
 1270             ) crew
 1271             ON
 1272             LOC_OMS_LOCATION_ID = crew.LOCATION_ID
 1273             AND
 1274             CAD_LEAD_CREW = crew.CREW_NO
 1275       
 1276       
 1277       
 1278       
 1279           )
 1280          )
 1281         )
 1282         WHERE
 1283         (DISTRICT IS NOT NULL AND DISTRICT NOT IN ('UNKNOWN'))
 1284         AND UPPER(CREW_STATUS) NOT IN ('CANCELLED', 'PLANNED')
 1285         AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT')
 1286         AND CALL_TYPE IN
 1287         (
 1288           'EMER'
 1289           ,'OUT'
 1290         )
 1291         AND
 1292         (
 1293           (ROUND((24*60*60*(ENERGT - CREATION_DATETIME)),2) >= 300 AND ENERGT IS NOT NULL)
 1294           OR
 1295           ENERGT IS NULL
 1296         )
 1297       )
 1298       /* CROSS JOIN STORM_REPORTDATE@VIEW_OHTST WHERE (CREATION_DATETIME >= STORM_REPORTDATE.START_DATETIME) AND
 1298     ! (CREATION_DATETIME <= STORM_REPORTDATE.END_DATETIME OR STORM_REPORTDATE.END_DATETIME IS NULL) */
 1299       ORDER BY CREATION_DATETIME, CAD_ID
 1300       
 1301       
 1302       );

 NOTE: Table WORK.V_ETR_SUMMARY_BASELINE_STORM created, with 817 rows and 41 columns.
 
 1303       DISCONNECT FROM ORACLE;
 1304       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           9.93 seconds
       cpu time            0.04 seconds
       
 
 1305       
 1306       
 1307       PROC SQL;
 1308          CREATE TABLE WORK.qryStorm_Fmt_Dates AS
 1309          SELECT t1.DISTRICT,
 1310                 t1.CIRCT_NO,
 1311                 t1.VLG_TWN_CTY,
 1312                 t1.CREATION_DATETIME FORMAT=NLDATML20. AS CREATION_DATETIME,
 1313                 t1.CREATION_INTERVAL FORMAT=NLDATML20. AS CREATION_INTERVAL,
 1314                 t1.ENERGT FORMAT=NLDATML20. AS ENERGT,
 1315                 t1.RESTORED_DURING_INTERVAL FORMAT=NLDATML20. AS RESTORED_DURING_INTERVAL,
 1316                 t1.RESTORED_AS_OF_INTERVAL FORMAT=NLDATML20. AS RESTORED_AS_OF_INTERVAL,
 1317                 t1.FINAL_ETR FORMAT=NLDATML20. AS FINAL_ETR,
 1318                 t1.CAD_ID,
 1319                 t1.OMS_LOCATION_ADDR,
 1320                 t1.PARENT_JOB,
 1321                 t1.CALL_TYPE,
 1322                 t1.JOB_TYPE,
 1323                 t1.JOB_TYPE_DESC,
 1324                 t1.OUTAGE_PRIORITY,
 1325                 t1.REFERRED_TO,
 1326                 t1.OMS_LOCATION_ID,
 1327                 t1.TTL_CUST_OUT,
 1328                 t1.TTL_CALLS,
 1329                 t1.STOP_ETR_RECALC,
 1330                 t1.JOB_STATUS,
 1331                 t1.CREW_STATUS,
 1332                 t1.CREW_TYPE,
 1333                 t1.LEAD_CREW,
 1334                 t1.CAUSE_DESC,
 1335                 t1.DAMAGE_DESC,
 1336                 t1.ISR_CAD_ID,
 1337                 t1.LEAD_CREW_STATUS,
 1338                 t1.CURRENT_TIME FORMAT=NLDATML20. AS CURRENT_TIME,
 1339                 t1.AGE_BY_CREATION_HRS_MIN_SEC,
 1340                 t1.AGE_BY_CREATION_MIN,
 1341                 t1.CREW_DISPATCHED_DATETIME FORMAT=NLDATML20. AS CREW_DISPATCHED_DATETIME,
 1342                 t1.AGE_BY_DISPATCHED_HRS_MIN_SEC,
 1343                 t1.AGE_BY_DISPATCH_MIN,
 1344                 t1.CREW_LAST_STATUS_DATETIME,
 1345                 t1.AGE_BY_LAST_STATUS_HRS_MIN_SEC,
 1346                 t1.AGE_BY_LAST_STATUS_MIN,
 1347                 t1.START_DATETIME FORMAT=NLDATML20. AS START_DATETIME,
 1348                 /* t1.END_DATETIME FORMAT=NLDATML20. AS END_DATETIME */
 1349         '.' AS END_DATETIME
 1350             FROM WORK.V_ETR_SUMMARY_BASELINE_STORM t1;
 NOTE: Table WORK.QRYSTORM_FMT_DATES created, with 817 rows and 40 columns.
 
 1351             /*WHERE (t1.COMP_TYPE IN ('P','T','S','I','O')) OR (t1.COMP_TYPE IS MISSING);*/
 1352             /*WHERE (t1.COMP_TYPE IN ('P','T')) OR (t1.COMP_TYPE IS MISSING);*/
 1353       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 1354       
 1355       
 1356       /* ********************************************** SYSWIDE HOURLY DATA ********************************************** */
 1357       
 1358       
 1359       PROC SQL;
 1360       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 1361       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 1362       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 1363       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 1363     ! */
 1364       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P');*/ /* #CONNECT TO PROD
 1364     !  67 HN */
 1365       EXECUTE
 1366       (
 1367       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 1368       ) BY ORACLE;
 1369       CREATE TABLE WORK.GETSTORMDATES AS
 1370       SELECT * FROM CONNECTION TO ORACLE
 1371       (
 1372       SELECT
 1373           TO_DATE(TRUNC(SYSDATE) - 10, 'MM/DD/YYYY HH24:MI:SS') AS "START_DATETIME"
 1374           ,'.' AS "END_DATETIME"
 1375       FROM DUAL
 1376       );
 NOTE: Table WORK.GETSTORMDATES created, with 1 rows and 2 columns.
 
 1377       DISCONNECT FROM ORACLE;
 1378       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.16 seconds
       cpu time            0.00 seconds
       
 
 1379       
 1380       
 1381       PROC SQL;
 1382          CREATE TABLE WORK.qryGetStormDates AS
 1383          SELECT t1.START_DATETIME FORMAT=NLDATML20. AS START_DATETIME
 1384                 ,t1.END_DATETIME AS END_DATETIME
 1385             FROM WORK.GETSTORMDATES t1;
 NOTE: Table WORK.QRYGETSTORMDATES created, with 1 rows and 2 columns.
 
 1386       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 1387       
 1388       
 1389       PROC SQL;
 1390       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 1391       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 1392       EXECUTE
 1393       (
 1394       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 1395       ) BY ORACLE;
 1396       CREATE TABLE WORK.CONNECT_BY AS
 1397       SELECT * FROM CONNECTION TO ORACLE
 1398       (
 1399       SELECT
 1400        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 1400     ! DATE_INTERVAL
 1401       FROM DUAL
 1402       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 1402     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 1403       );
 NOTE: Table WORK.CONNECT_BY created, with 251 rows and 1 columns.
 
 1404       DISCONNECT FROM ORACLE;
 1405       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.17 seconds
       cpu time            0.00 seconds
       
 
 1406       
 1407       PROC SQL;
 1408       CREATE TABLE WORK.CONNECT_BY2 AS
 1409       
 1410       SELECT
 1411       DATE_INTERVAL
 1412       
 1413       ,CREATION_INTERVAL
 1414       ,CASE
 1415       WHEN NEW_INCIDENTS IS NULL
 1416       THEN 0
 1417       ELSE NEW_INCIDENTS
 1418       END AS NEW_INCIDENTS
 1419       
 1420       ,CASE
 1421       WHEN NEW_CUSTOMERS_OUT IS NULL
 1422       THEN 0
 1423       ELSE NEW_CUSTOMERS_OUT
 1424       END AS NEW_CUSTOMERS_OUT
 1425       
 1426       ,RESTORED_DURING_INTERVAL
 1427       
 1428       ,CASE
 1429       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 1430       THEN 0
 1431       ELSE INCIDENTS_RESTORED_BY_HOUR
 1432       END AS INCIDENTS_RESTORED_BY_HOUR
 1433       
 1434       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 1435       THEN 0
 1436       ELSE CUSTOMERS_RESTORED_BY_HOUR
 1437       END AS CUSTOMERS_RESTORED_BY_HOUR
 1438       
 1439       FROM
 1440       (
 1441         SELECT
 1442       *
 1443         FROM WORK.CONNECT_BY
 1444       
 1445         LEFT JOIN
 1446         (
 1447       SELECT
 1448         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 1449         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 1450         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 1451       FROM WORK.QRYSTORM_FMT_DATES T1
 1452       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 1452     !  NOT IN ('CANCELLED', 'PLANNED')
 1453       GROUP BY T1.CREATION_INTERVAL
 1454         ) T1
 1455         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 1456       
 1457         LEFT JOIN
 1458         (
 1459       SELECT
 1460         RESTORED_DURING_INTERVAL
 1461         ,INCIDENTS_RESTORED_BY_HOUR
 1462         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 1463         ,CUSTOMERS_RESTORED_BY_HOUR
 1464         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 1465       FROM
 1466       (
 1467         SELECT
 1468       RESTORED_DURING_INTERVAL
 1469       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 1470       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 1471         FROM WORK.QRYSTORM_FMT_DATES
 1472         WHERE
 1473         (
 1474       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 1474     ! IN ('CANCELLED', 'PLANNED')
 1475       AND RESTORED_DURING_INTERVAL IS NOT NULL
 1476         )
 1477         GROUP BY RESTORED_DURING_INTERVAL
 1478       )
 1479       GROUP BY RESTORED_DURING_INTERVAL
 1480       ) T2
 1481       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 1482         )
 1483         GROUP BY DATE_INTERVAL
 1484         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2 created, with 251 rows and 7 columns.
 
 1485       
 1486       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 1487       
 1488       DATA GET_RUNNING_TTLS;
 1489         SET WORK.CONNECT_BY2;
 1490         RT_OF_INCIDENTS+NEW_INCIDENTS;
 1491         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 1492         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 1493         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 1494       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2.
 NOTE: The data set WORK.GET_RUNNING_TTLS has 251 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1495       
 1496       PROC SQL;
 1497       CREATE TABLE WORK.QV_HOURLY_TOTALS55 AS
 1498       SELECT
 1499         ('0 - PSEGLI ALL') AS DIVISION
 1500         ,DATE_INTERVALFORMAT=NLDATML20.
 1501         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 1502         /*,CREATION_INTERVAL*/
 1503         ,NEW_INCIDENTS
 1504         ,RT_OF_INCIDENTS
 1505         ,NEW_CUSTOMERS_OUT
 1506         ,RT_OF_CUSTOMERS_OUT
 1507         /*,RESTORED_DURING_INTERVAL*/
 1508         ,INCIDENTS_RESTORED_BY_HOUR
 1509         ,RT_INCIDENTS_RESTORED
 1510         ,CUSTOMERS_RESTORED_BY_HOUR
 1511         ,RT_CUSTOMERS_RESTORED
 1512         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 1513         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 1514       FROM WORK.GET_RUNNING_TTLS
 1515       
 1516       WHERE
 1517       DATE_INTERVAL >= "&gblStartStm"dt
 1518       AND
 1519       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 1520       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 1521       ORDER BY DATE_INTERVAL;
 NOTE: Table WORK.QV_HOURLY_TOTALS55 created, with 249 rows and 13 columns.
 
 1522       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 1523       
 1524       %put STARTTIME IN GLOBAL: &gblStartStm;
 STARTTIME IN GLOBAL: 24SEP2021:00:00:00
 1525       %put ENDTIME IN GLOBAL: &gblEndStm;
 ENDTIME IN GLOBAL: 04OCT2021:09:00:00
 1526       
 1527       
 1528       PROC SQL;
 1529       DROP TABLE WORK.CONNECT_BY;

 NOTE: Table WORK.CONNECT_BY has been dropped.
 1530       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1531       
 1532       PROC SQL;
 1533       DROP TABLE WORK.CONNECT_BY2;
 NOTE: Table WORK.CONNECT_BY2 has been dropped.
 1534       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1535       
 1536       PROC DELETE DATA=WORK.GET_RUNNING_TTLS;
 1537       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 1538       
 1539       /* ********************************************** SYSWIDE HOURLY DATA ********************************************** */
 1540       
 1541       
 1542       
 1543       /* ********************************************** QN HOURLY DATA ********************************************** */
 1544       
 1545       
 1546       PROC SQL;
 1547       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 1548       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 1549       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 1550       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 1550     ! */
 1551       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 1551     ! PROD 67 HN */
 1552       EXECUTE
 1553       (
 1554       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 1555       ) BY ORACLE;
 1556       CREATE TABLE WORK.CONNECT_BY_QN AS
 1557       SELECT * FROM CONNECTION TO ORACLE
 1558       (
 1559       SELECT
 1560        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 1560     ! DATE_INTERVAL
 1561       FROM DUAL
 1562       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 1562     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 1563       );
 NOTE: Table WORK.CONNECT_BY_QN created, with 251 rows and 1 columns.
 
 1564       DISCONNECT FROM ORACLE;
 1565       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.17 seconds
       cpu time            0.01 seconds
       
 
 1566       
 1567       PROC SQL;
 1568       CREATE TABLE WORK.CONNECT_BY2_QN AS
 1569       
 1570       SELECT
 1571       DATE_INTERVAL
 1572       
 1573       ,CREATION_INTERVAL
 1574       ,CASE
 1575       WHEN NEW_INCIDENTS IS NULL
 1576       THEN 0
 1577       ELSE NEW_INCIDENTS
 1578       END AS NEW_INCIDENTS
 1579       
 1580       ,CASE
 1581       WHEN NEW_CUSTOMERS_OUT IS NULL
 1582       THEN 0
 1583       ELSE NEW_CUSTOMERS_OUT
 1584       END AS NEW_CUSTOMERS_OUT
 1585       
 1586       ,RESTORED_DURING_INTERVAL
 1587       
 1588       ,CASE
 1589       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 1590       THEN 0
 1591       ELSE INCIDENTS_RESTORED_BY_HOUR
 1592       END AS INCIDENTS_RESTORED_BY_HOUR
 1593       
 1594       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 1595       THEN 0
 1596       ELSE CUSTOMERS_RESTORED_BY_HOUR
 1597       END AS CUSTOMERS_RESTORED_BY_HOUR
 1598       
 1599       FROM
 1600       (
 1601         SELECT
 1602       *
 1603         FROM WORK.CONNECT_BY_QN
 1604       
 1605         LEFT JOIN
 1606         (
 1607       SELECT
 1608         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 1609         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 1610         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 1611       FROM WORK.QRYSTORM_FMT_DATES T1
 1612       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 1612     !  NOT IN ('CANCELLED', 'PLANNED') AND DISTRICT = '1 - Queens, Nas.'
 1613       GROUP BY T1.CREATION_INTERVAL
 1614         ) T1
 1615         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 1616       
 1617         LEFT JOIN
 1618         (
 1619       SELECT
 1620         RESTORED_DURING_INTERVAL
 1621         ,INCIDENTS_RESTORED_BY_HOUR
 1622         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 1623         ,CUSTOMERS_RESTORED_BY_HOUR
 1624         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 1625       FROM
 1626       (
 1627         SELECT
 1628       RESTORED_DURING_INTERVAL
 1629       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 1630       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 1631         FROM WORK.QRYSTORM_FMT_DATES
 1632         WHERE
 1633         (
 1634       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 1634     ! IN ('CANCELLED', 'PLANNED') AND DISTRICT = '1 - Queens, Nas.'
 1635       AND RESTORED_DURING_INTERVAL IS NOT NULL
 1636         )
 1637         GROUP BY RESTORED_DURING_INTERVAL
 1638       )
 1639       GROUP BY RESTORED_DURING_INTERVAL
 1640       ) T2
 1641       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 1642         )
 1643         GROUP BY DATE_INTERVAL
 1644         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2_QN created, with 251 rows and 7 columns.
 
 1645       
 1646       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.02 seconds
       cpu time            0.02 seconds
       
 
 1647       
 1648       DATA GET_RUNNING_TTLS_QN;
 1649         SET WORK.CONNECT_BY2_QN;
 1650         RT_OF_INCIDENTS+NEW_INCIDENTS;
 1651         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 1652         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 1653         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 1654       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2_QN.
 NOTE: The data set WORK.GET_RUNNING_TTLS_QN has 251 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1655       
 1656       PROC SQL;
 1657       CREATE TABLE WORK.QRYHOURLY_TOTALS_QN AS
 1658       SELECT
 1659         ('1 - Queens, Nas.') AS DIVISION
 1660         ,DATE_INTERVALFORMAT=NLDATML20.
 1661         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 1662         /*,CREATION_INTERVAL*/
 1663         ,NEW_INCIDENTS
 1664         ,RT_OF_INCIDENTS
 1665         ,NEW_CUSTOMERS_OUT
 1666         ,RT_OF_CUSTOMERS_OUT
 1667         /*,RESTORED_DURING_INTERVAL*/
 1668         ,INCIDENTS_RESTORED_BY_HOUR
 1669         ,RT_INCIDENTS_RESTORED
 1670         ,CUSTOMERS_RESTORED_BY_HOUR
 1671         ,RT_CUSTOMERS_RESTORED
 1672         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 1673         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 1674       FROM WORK.GET_RUNNING_TTLS_QN
 1675       WHERE
 1676       DATE_INTERVAL >= "&gblStartStm"dt
 1677       AND
 1678       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 1679       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 1680       ORDER BY DATE_INTERVAL;
 NOTE: Table WORK.QRYHOURLY_TOTALS_QN created, with 249 rows and 13 columns.
 
 1681       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 1682       
 1683       PROC SQL;
 1684       DROP TABLE WORK.CONNECT_BY_QN;
 NOTE: Table WORK.CONNECT_BY_QN has been dropped.
 1685       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1686       
 1687       PROC SQL;
 1688       DROP TABLE WORK.CONNECT_BY2_QN;
 NOTE: Table WORK.CONNECT_BY2_QN has been dropped.
 1689       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1690       
 1691       PROC DELETE DATA=WORK.GET_RUNNING_TTLS_QN;
 1692       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS_QN (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1693       
 1694       
 1695       /* ********************************************** QN HOURLY DATA ********************************************** */
 1696       
 1697       
 1698       
 1699       /* ********************************************** CN HOURLY DATA ********************************************** */
 1700       
 1701       PROC SQL;
 1702       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 1703       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 1704       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 1705       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 1705     ! */
 1706       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 1706     ! PROD 67 HN */
 1707       EXECUTE
 1708       (
 1709       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 1710       ) BY ORACLE;
 1711       CREATE TABLE WORK.CONNECT_BY_CN AS
 1712       SELECT * FROM CONNECTION TO ORACLE
 1713       (
 1714       SELECT
 1715        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 1715     ! DATE_INTERVAL
 1716       FROM DUAL
 1717       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 1717     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 1718       );
 NOTE: Table WORK.CONNECT_BY_CN created, with 251 rows and 1 columns.
 
 1719       DISCONNECT FROM ORACLE;
 1720       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.17 seconds
       cpu time            0.02 seconds
       
 
 1721       
 1722       PROC SQL;
 1723       CREATE TABLE WORK.CONNECT_BY2_CN AS
 1724       
 1725       SELECT
 1726       DATE_INTERVAL
 1727       
 1728       ,CREATION_INTERVAL
 1729       ,CASE
 1730       WHEN NEW_INCIDENTS IS NULL
 1731       THEN 0
 1732       ELSE NEW_INCIDENTS
 1733       END AS NEW_INCIDENTS
 1734       
 1735       ,CASE
 1736       WHEN NEW_CUSTOMERS_OUT IS NULL
 1737       THEN 0
 1738       ELSE NEW_CUSTOMERS_OUT
 1739       END AS NEW_CUSTOMERS_OUT
 1740       
 1741       ,RESTORED_DURING_INTERVAL
 1742       
 1743       ,CASE
 1744       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 1745       THEN 0
 1746       ELSE INCIDENTS_RESTORED_BY_HOUR
 1747       END AS INCIDENTS_RESTORED_BY_HOUR
 1748       
 1749       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 1750       THEN 0
 1751       ELSE CUSTOMERS_RESTORED_BY_HOUR
 1752       END AS CUSTOMERS_RESTORED_BY_HOUR
 1753       
 1754       FROM
 1755       (
 1756         SELECT
 1757       *
 1758         FROM WORK.CONNECT_BY_CN
 1759       
 1760         LEFT JOIN
 1761         (
 1762       SELECT
 1763         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 1764         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 1765         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 1766       FROM WORK.QRYSTORM_FMT_DATES T1
 1767       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 1767     !  NOT IN ('CANCELLED', 'PLANNED') AND DISTRICT = '2 - Central, Nas.'
 1768       GROUP BY T1.CREATION_INTERVAL
 1769         ) T1
 1770         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 1771       
 1772         LEFT JOIN
 1773         (
 1774       SELECT
 1775         RESTORED_DURING_INTERVAL
 1776         ,INCIDENTS_RESTORED_BY_HOUR
 1777         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 1778         ,CUSTOMERS_RESTORED_BY_HOUR
 1779         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 1780       FROM
 1781       (
 1782         SELECT
 1783       RESTORED_DURING_INTERVAL
 1784       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 1785       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 1786         FROM WORK.QRYSTORM_FMT_DATES
 1787         WHERE
 1788         (
 1789       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 1789     ! IN ('CANCELLED', 'PLANNED') AND DISTRICT = '2 - Central, Nas.'
 1790       AND RESTORED_DURING_INTERVAL IS NOT NULL
 1791         )
 1792         GROUP BY RESTORED_DURING_INTERVAL
 1793       )
 1794       GROUP BY RESTORED_DURING_INTERVAL
 1795       ) T2
 1796       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 1797         )
 1798         GROUP BY DATE_INTERVAL
 1799         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2_CN created, with 251 rows and 7 columns.
 
 1800       
 1801       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 1802       
 1803       DATA GET_RUNNING_TTLS_CN;
 1804         SET WORK.CONNECT_BY2_CN;
 1805         RT_OF_INCIDENTS+NEW_INCIDENTS;
 1806         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 1807         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 1808         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 1809       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2_CN.
 NOTE: The data set WORK.GET_RUNNING_TTLS_CN has 251 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1810       
 1811       PROC SQL;
 1812       CREATE TABLE WORK.QRYHOURLY_TOTALS_CN AS
 1813       SELECT
 1814         ('2 - Central, Nas.') AS DIVISION
 1815         ,DATE_INTERVALFORMAT=NLDATML20.
 1816         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 1817         /*,CREATION_INTERVAL*/
 1818         ,NEW_INCIDENTS
 1819         ,RT_OF_INCIDENTS
 1820         ,NEW_CUSTOMERS_OUT
 1821         ,RT_OF_CUSTOMERS_OUT
 1822         /*,RESTORED_DURING_INTERVAL*/
 1823         ,INCIDENTS_RESTORED_BY_HOUR
 1824         ,RT_INCIDENTS_RESTORED
 1825         ,CUSTOMERS_RESTORED_BY_HOUR
 1826         ,RT_CUSTOMERS_RESTORED
 1827         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 1828         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 1829       FROM WORK.GET_RUNNING_TTLS_CN
 1830       WHERE
 1831       DATE_INTERVAL >= "&gblStartStm"dt
 1832       AND
 1833       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 1834       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 1835       ORDER BY DATE_INTERVAL;

 NOTE: Table WORK.QRYHOURLY_TOTALS_CN created, with 249 rows and 13 columns.
 
 1836       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 1837       
 1838       PROC SQL;
 1839       DROP TABLE WORK.CONNECT_BY_CN;
 NOTE: Table WORK.CONNECT_BY_CN has been dropped.
 1840       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1841       
 1842       PROC SQL;
 1843       DROP TABLE WORK.CONNECT_BY2_CN;
 NOTE: Table WORK.CONNECT_BY2_CN has been dropped.
 1844       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1845       
 1846       PROC DELETE DATA=WORK.GET_RUNNING_TTLS_CN;
 1847       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS_CN (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1848       
 1849       
 1850       /* ********************************************** CN HOURLY DATA ********************************************** */
 1851       
 1852       
 1853       
 1854       /* ********************************************** WS HOURLY DATA ********************************************** */
 1855       
 1856       
 1857       PROC SQL;
 1858       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 1859       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 1860       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 1861       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 1861     ! */
 1862       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 1862     ! PROD 67 HN */
 1863       EXECUTE
 1864       (
 1865       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 1866       ) BY ORACLE;
 1867       CREATE TABLE WORK.CONNECT_BY_WS AS
 1868       SELECT * FROM CONNECTION TO ORACLE
 1869       (
 1870       SELECT
 1871        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 1871     ! DATE_INTERVAL
 1872       FROM DUAL
 1873       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 1873     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 1874       );
 NOTE: Table WORK.CONNECT_BY_WS created, with 251 rows and 1 columns.
 
 1875       DISCONNECT FROM ORACLE;
 1876       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.17 seconds
       cpu time            0.01 seconds
       
 
 1877       
 1878       PROC SQL;
 1879       CREATE TABLE WORK.CONNECT_BY2_WS AS
 1880       
 1881       SELECT
 1882       DATE_INTERVAL
 1883       
 1884       ,CREATION_INTERVAL
 1885       ,CASE
 1886       WHEN NEW_INCIDENTS IS NULL
 1887       THEN 0
 1888       ELSE NEW_INCIDENTS
 1889       END AS NEW_INCIDENTS
 1890       
 1891       ,CASE
 1892       WHEN NEW_CUSTOMERS_OUT IS NULL
 1893       THEN 0
 1894       ELSE NEW_CUSTOMERS_OUT
 1895       END AS NEW_CUSTOMERS_OUT
 1896       
 1897       ,RESTORED_DURING_INTERVAL
 1898       
 1899       ,CASE
 1900       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 1901       THEN 0
 1902       ELSE INCIDENTS_RESTORED_BY_HOUR
 1903       END AS INCIDENTS_RESTORED_BY_HOUR
 1904       
 1905       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 1906       THEN 0
 1907       ELSE CUSTOMERS_RESTORED_BY_HOUR
 1908       END AS CUSTOMERS_RESTORED_BY_HOUR
 1909       
 1910       FROM
 1911       (
 1912         SELECT
 1913       *
 1914         FROM WORK.CONNECT_BY_WS
 1915       
 1916         LEFT JOIN
 1917         (
 1918       SELECT
 1919         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 1920         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 1921         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 1922       FROM WORK.QRYSTORM_FMT_DATES T1
 1923       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 1923     !  NOT IN ('CANCELLED', 'PLANNED') AND DISTRICT = '3 - Western, Suf.'
 1924       GROUP BY T1.CREATION_INTERVAL
 1925         ) T1
 1926         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 1927       
 1928         LEFT JOIN
 1929         (
 1930       SELECT
 1931         RESTORED_DURING_INTERVAL
 1932         ,INCIDENTS_RESTORED_BY_HOUR
 1933         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 1934         ,CUSTOMERS_RESTORED_BY_HOUR
 1935         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 1936       FROM
 1937       (
 1938         SELECT
 1939       RESTORED_DURING_INTERVAL
 1940       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 1941       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 1942         FROM WORK.QRYSTORM_FMT_DATES
 1943         WHERE
 1944         (
 1945       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 1945     ! IN ('CANCELLED', 'PLANNED') AND DISTRICT = '3 - Western, Suf.'
 1946       AND RESTORED_DURING_INTERVAL IS NOT NULL
 1947         )
 1948         GROUP BY RESTORED_DURING_INTERVAL
 1949       )
 1950       GROUP BY RESTORED_DURING_INTERVAL
 1951       ) T2
 1952       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 1953         )
 1954         GROUP BY DATE_INTERVAL
 1955         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2_WS created, with 251 rows and 7 columns.
 
 1956       
 1957       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 1958       
 1959       DATA GET_RUNNING_TTLS_WS;
 1960         SET WORK.CONNECT_BY2_WS;
 1961         RT_OF_INCIDENTS+NEW_INCIDENTS;
 1962         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 1963         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 1964         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 1965       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2_WS.
 NOTE: The data set WORK.GET_RUNNING_TTLS_WS has 251 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1966       
 1967       PROC SQL;
 1968       CREATE TABLE WORK.QRYHOURLY_TOTALS_WS AS
 1969       SELECT
 1970         ('3 - Western, Suf.') AS DIVISION
 1971         ,DATE_INTERVALFORMAT=NLDATML20.
 1972         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 1973         /*,CREATION_INTERVAL*/
 1974         ,NEW_INCIDENTS
 1975         ,RT_OF_INCIDENTS
 1976         ,NEW_CUSTOMERS_OUT
 1977         ,RT_OF_CUSTOMERS_OUT
 1978         /*,RESTORED_DURING_INTERVAL*/
 1979         ,INCIDENTS_RESTORED_BY_HOUR
 1980         ,RT_INCIDENTS_RESTORED
 1981         ,CUSTOMERS_RESTORED_BY_HOUR
 1982         ,RT_CUSTOMERS_RESTORED
 1983         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 1984         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 1985       FROM WORK.GET_RUNNING_TTLS_WS
 1986       WHERE
 1987       DATE_INTERVAL >= "&gblStartStm"dt
 1988       AND
 1989       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 1990       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 1991       ORDER BY DATE_INTERVAL;
 NOTE: Table WORK.QRYHOURLY_TOTALS_WS created, with 249 rows and 13 columns.
 
 1992       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 1993       
 1994       PROC SQL;
 1995       DROP TABLE WORK.CONNECT_BY_WS;
 NOTE: Table WORK.CONNECT_BY_WS has been dropped.
 1996       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 1997       
 1998       PROC SQL;
 1999       DROP TABLE WORK.CONNECT_BY2_WS;
 NOTE: Table WORK.CONNECT_BY2_WS has been dropped.
 2000       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2001       
 2002       PROC DELETE DATA=WORK.GET_RUNNING_TTLS_WS;
 2003       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS_WS (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2004       
 2005       
 2006       /* ********************************************** WS HOURLY DATA ********************************************** */
 2007       
 2008       
 2009       
 2010       /* ********************************************** ES HOURLY DATA ********************************************** */
 2011       
 2012       PROC SQL;
 2013       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 2014       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 2015       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 2016       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 2016     ! */
 2017       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 2017     ! PROD 67 HN */
 2018       EXECUTE
 2019       (
 2020       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 2021       ) BY ORACLE;
 2022       CREATE TABLE WORK.CONNECT_BY_ES AS
 2023       SELECT * FROM CONNECTION TO ORACLE
 2024       (
 2025       SELECT
 2026        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 2026     ! DATE_INTERVAL
 2027       FROM DUAL
 2028       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 2028     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 2029       );
 NOTE: Table WORK.CONNECT_BY_ES created, with 251 rows and 1 columns.
 
 2030       DISCONNECT FROM ORACLE;
 2031       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.19 seconds
       cpu time            0.01 seconds
       
 
 2032       
 2033       PROC SQL;
 2034       CREATE TABLE WORK.CONNECT_BY2_ES AS
 2035       
 2036       SELECT
 2037       DATE_INTERVAL
 2038       
 2039       ,CREATION_INTERVAL
 2040       ,CASE
 2041       WHEN NEW_INCIDENTS IS NULL
 2042       THEN 0
 2043       ELSE NEW_INCIDENTS
 2044       END AS NEW_INCIDENTS
 2045       
 2046       ,CASE
 2047       WHEN NEW_CUSTOMERS_OUT IS NULL
 2048       THEN 0
 2049       ELSE NEW_CUSTOMERS_OUT
 2050       END AS NEW_CUSTOMERS_OUT
 2051       
 2052       ,RESTORED_DURING_INTERVAL
 2053       
 2054       ,CASE
 2055       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 2056       THEN 0
 2057       ELSE INCIDENTS_RESTORED_BY_HOUR
 2058       END AS INCIDENTS_RESTORED_BY_HOUR
 2059       
 2060       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 2061       THEN 0
 2062       ELSE CUSTOMERS_RESTORED_BY_HOUR
 2063       END AS CUSTOMERS_RESTORED_BY_HOUR
 2064       
 2065       FROM
 2066       (
 2067         SELECT
 2068       *
 2069         FROM WORK.CONNECT_BY_ES
 2070       
 2071         LEFT JOIN
 2072         (
 2073       SELECT
 2074         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 2075         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 2076         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 2077       FROM WORK.QRYSTORM_FMT_DATES T1
 2078       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 2078     !  NOT IN ('CANCELLED', 'PLANNED') AND DISTRICT = '4 - Eastern, Suf.'
 2079       GROUP BY T1.CREATION_INTERVAL
 2080         ) T1
 2081         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 2082       
 2083         LEFT JOIN
 2084         (
 2085       SELECT
 2086         RESTORED_DURING_INTERVAL
 2087         ,INCIDENTS_RESTORED_BY_HOUR
 2088         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 2089         ,CUSTOMERS_RESTORED_BY_HOUR
 2090         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 2091       FROM
 2092       (
 2093         SELECT
 2094       RESTORED_DURING_INTERVAL
 2095       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 2096       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 2097         FROM WORK.QRYSTORM_FMT_DATES
 2098         WHERE
 2099         (
 2100       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 2100     ! IN ('CANCELLED', 'PLANNED') AND DISTRICT = '4 - Eastern, Suf.'
 2101       AND RESTORED_DURING_INTERVAL IS NOT NULL
 2102         )
 2103         GROUP BY RESTORED_DURING_INTERVAL
 2104       )
 2105       GROUP BY RESTORED_DURING_INTERVAL
 2106       ) T2
 2107       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 2108         )
 2109         GROUP BY DATE_INTERVAL
 2110         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2_ES created, with 251 rows and 7 columns.
 
 2111       
 2112       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 2113       
 2114       DATA GET_RUNNING_TTLS_ES;
 2115         SET WORK.CONNECT_BY2_ES;
 2116         RT_OF_INCIDENTS+NEW_INCIDENTS;
 2117         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 2118         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 2119         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 2120       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2_ES.
 NOTE: The data set WORK.GET_RUNNING_TTLS_ES has 251 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2121       
 2122       PROC SQL;
 2123       CREATE TABLE WORK.QRYHOURLY_TOTALS_ES AS
 2124       SELECT
 2125         ('4 - Eastern, Suf.') AS DIVISION
 2126         ,DATE_INTERVALFORMAT=NLDATML20.
 2127         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 2128         /*,CREATION_INTERVAL*/
 2129         ,NEW_INCIDENTS
 2130         ,RT_OF_INCIDENTS
 2131         ,NEW_CUSTOMERS_OUT
 2132         ,RT_OF_CUSTOMERS_OUT
 2133         /*,RESTORED_DURING_INTERVAL*/
 2134         ,INCIDENTS_RESTORED_BY_HOUR
 2135         ,RT_INCIDENTS_RESTORED
 2136         ,CUSTOMERS_RESTORED_BY_HOUR
 2137         ,RT_CUSTOMERS_RESTORED
 2138         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 2139         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 2140       FROM WORK.GET_RUNNING_TTLS_ES
 2141       WHERE
 2142       DATE_INTERVAL >= "&gblStartStm"dt
 2143       AND
 2144       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 2145       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 2146       ORDER BY DATE_INTERVAL;
 NOTE: Table WORK.QRYHOURLY_TOTALS_ES created, with 249 rows and 13 columns.
 
 2147       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2148       
 2149       PROC SQL;
 2150       DROP TABLE WORK.CONNECT_BY_ES;

 NOTE: Table WORK.CONNECT_BY_ES has been dropped.
 2151       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2152       
 2153       PROC SQL;
 2154       DROP TABLE WORK.CONNECT_BY2_ES;
 NOTE: Table WORK.CONNECT_BY2_ES has been dropped.
 2155       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2156       
 2157       PROC DELETE DATA=WORK.GET_RUNNING_TTLS_ES;
 2158       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS_ES (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2159       
 2160       
 2161       /* ********************************************** ES HOURLY DATA ********************************************** */
 2162       
 2163       
 2164       
 2165       /* ********************************************** NASSAU HOURLY DATA ********************************************** */
 2166       
 2167       
 2168       PROC SQL;
 2169       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 2170       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 2171       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 2172       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 2172     ! */
 2173       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 2173     ! PROD 67 HN */
 2174       EXECUTE
 2175       (
 2176       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 2177       ) BY ORACLE;
 2178       CREATE TABLE WORK.CONNECT_BY_NAS AS
 2179       SELECT * FROM CONNECTION TO ORACLE
 2180       (
 2181       SELECT
 2182        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 2182     ! DATE_INTERVAL
 2183       FROM DUAL
 2184       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 2184     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 2185       );
 NOTE: Table WORK.CONNECT_BY_NAS created, with 251 rows and 1 columns.
 
 2186       DISCONNECT FROM ORACLE;
 2187       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.19 seconds
       cpu time            0.02 seconds
       
 
 2188       
 2189       PROC SQL;
 2190       CREATE TABLE WORK.CONNECT_BY2_NAS AS
 2191       
 2192       SELECT
 2193       DATE_INTERVAL
 2194       
 2195       ,CREATION_INTERVAL
 2196       ,CASE
 2197       WHEN NEW_INCIDENTS IS NULL
 2198       THEN 0
 2199       ELSE NEW_INCIDENTS
 2200       END AS NEW_INCIDENTS
 2201       
 2202       ,CASE
 2203       WHEN NEW_CUSTOMERS_OUT IS NULL
 2204       THEN 0
 2205       ELSE NEW_CUSTOMERS_OUT
 2206       END AS NEW_CUSTOMERS_OUT
 2207       
 2208       ,RESTORED_DURING_INTERVAL
 2209       
 2210       ,CASE
 2211       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 2212       THEN 0
 2213       ELSE INCIDENTS_RESTORED_BY_HOUR
 2214       END AS INCIDENTS_RESTORED_BY_HOUR
 2215       
 2216       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 2217       THEN 0
 2218       ELSE CUSTOMERS_RESTORED_BY_HOUR
 2219       END AS CUSTOMERS_RESTORED_BY_HOUR
 2220       
 2221       FROM
 2222       (
 2223         SELECT
 2224       *
 2225         FROM WORK.CONNECT_BY_NAS
 2226       
 2227         LEFT JOIN
 2228         (
 2229       SELECT
 2230         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 2231         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 2232         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 2233       FROM WORK.QRYSTORM_FMT_DATES T1
 2234       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 2234     !  NOT IN ('CANCELLED', 'PLANNED') AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 2235       GROUP BY T1.CREATION_INTERVAL
 2236         ) T1
 2237         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 2238       
 2239         LEFT JOIN
 2240         (
 2241       SELECT
 2242         RESTORED_DURING_INTERVAL
 2243         ,INCIDENTS_RESTORED_BY_HOUR
 2244         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 2245         ,CUSTOMERS_RESTORED_BY_HOUR
 2246         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 2247       FROM
 2248       (
 2249         SELECT
 2250       RESTORED_DURING_INTERVAL
 2251       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 2252       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 2253         FROM WORK.QRYSTORM_FMT_DATES
 2254         WHERE
 2255         (
 2256       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 2256     ! IN ('CANCELLED', 'PLANNED') AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 2257       AND RESTORED_DURING_INTERVAL IS NOT NULL
 2258         )
 2259         GROUP BY RESTORED_DURING_INTERVAL
 2260       )
 2261       GROUP BY RESTORED_DURING_INTERVAL
 2262       ) T2
 2263       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 2264         )
 2265         GROUP BY DATE_INTERVAL
 2266         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2_NAS created, with 251 rows and 7 columns.
 
 2267       
 2268       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 2269       
 2270       DATA GET_RUNNING_TTLS_NAS;
 2271         SET WORK.CONNECT_BY2_NAS;
 2272         RT_OF_INCIDENTS+NEW_INCIDENTS;
 2273         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 2274         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 2275         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 2276       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2_NAS.
 NOTE: The data set WORK.GET_RUNNING_TTLS_NAS has 251 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2277       
 2278       PROC SQL;
 2279       CREATE TABLE WORK.QRYHOURLY_TOTALS_NAS AS
 2280       SELECT
 2281         ('5 - NASSAU') AS DIVISION
 2282         ,DATE_INTERVALFORMAT=NLDATML20.
 2283         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 2284         /*,CREATION_INTERVAL*/
 2285         ,NEW_INCIDENTS
 2286         ,RT_OF_INCIDENTS
 2287         ,NEW_CUSTOMERS_OUT
 2288         ,RT_OF_CUSTOMERS_OUT
 2289         /*,RESTORED_DURING_INTERVAL*/
 2290         ,INCIDENTS_RESTORED_BY_HOUR
 2291         ,RT_INCIDENTS_RESTORED
 2292         ,CUSTOMERS_RESTORED_BY_HOUR
 2293         ,RT_CUSTOMERS_RESTORED
 2294         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 2295         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 2296       FROM WORK.GET_RUNNING_TTLS_NAS
 2297       WHERE
 2298       DATE_INTERVAL >= "&gblStartStm"dt
 2299       AND
 2300       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 2301       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 2302       ORDER BY DATE_INTERVAL;
 NOTE: Table WORK.QRYHOURLY_TOTALS_NAS created, with 249 rows and 13 columns.
 
 2303       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 2304       
 2305       PROC SQL;
 2306       DROP TABLE WORK.CONNECT_BY_NAS;
 NOTE: Table WORK.CONNECT_BY_NAS has been dropped.
 2307       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2308       
 2309       PROC SQL;
 2310       DROP TABLE WORK.CONNECT_BY2_NAS;
 NOTE: Table WORK.CONNECT_BY2_NAS has been dropped.
 2311       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2312       
 2313       PROC DELETE DATA=WORK.GET_RUNNING_TTLS_NAS;
 2314       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS_NAS (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2315       
 2316       
 2317       /* ********************************************** NASSAU HOURLY DATA ********************************************** */
 2318       
 2319       
 2320       
 2321       /* ********************************************** SUFFOLK HOURLY DATA ********************************************** */
 2322       
 2323       
 2324       PROC SQL;
 2325       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 2326       /*CONNECT TO ORACLE(user=oh password=oh path='gcxp2-scan.livdc.local:1521/ohtst');*/ /* #connect to test oh55 */
 2327       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 2328       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 2328     ! */
 2329       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 2329     ! PROD 67 HN */
 2330       EXECUTE
 2331       (
 2332       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 2333       ) BY ORACLE;
 2334       CREATE TABLE WORK.CONNECT_BY_SUF AS
 2335       SELECT * FROM CONNECTION TO ORACLE
 2336       (
 2337       SELECT
 2338        (TRUNC((TRUNC(SYSDATE) - 10),'dd') + (FLOOR(to_char((TRUNC(SYSDATE) - 10),'sssss')/3600)/24) + ((LEVEL - 1)/ 24)) AS
 2338     ! DATE_INTERVAL
 2339       FROM DUAL
 2340       CONNECT BY LEVEL < ((24 * (NVL(TO_DATE(NULL, 'MM/DD/YYYY HH24:MI:SS'),TO_DATE(SYSDATE + 1/24, 'MM/DD/YYYY HH24:MI:SS')
 2340     ! ) - TO_DATE((TRUNC(SYSDATE) - 10), 'MM/DD/YYYY HH24:MI:SS') ) + 1 ) )
 2341       );
 NOTE: Table WORK.CONNECT_BY_SUF created, with 251 rows and 1 columns.
 
 2342       DISCONNECT FROM ORACLE;
 2343       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.17 seconds
       cpu time            0.01 seconds
       
 
 2344       
 2345       PROC SQL;
 2346       CREATE TABLE WORK.CONNECT_BY2_SUF AS
 2347       
 2348       SELECT
 2349       DATE_INTERVAL
 2350       
 2351       ,CREATION_INTERVAL
 2352       ,CASE
 2353       WHEN NEW_INCIDENTS IS NULL
 2354       THEN 0
 2355       ELSE NEW_INCIDENTS
 2356       END AS NEW_INCIDENTS
 2357       
 2358       ,CASE
 2359       WHEN NEW_CUSTOMERS_OUT IS NULL
 2360       THEN 0
 2361       ELSE NEW_CUSTOMERS_OUT
 2362       END AS NEW_CUSTOMERS_OUT
 2363       
 2364       ,RESTORED_DURING_INTERVAL
 2365       
 2366       ,CASE
 2367       WHEN INCIDENTS_RESTORED_BY_HOUR IS NULL
 2368       THEN 0
 2369       ELSE INCIDENTS_RESTORED_BY_HOUR
 2370       END AS INCIDENTS_RESTORED_BY_HOUR
 2371       
 2372       ,CASE WHEN CUSTOMERS_RESTORED_BY_HOUR IS NULL
 2373       THEN 0
 2374       ELSE CUSTOMERS_RESTORED_BY_HOUR
 2375       END AS CUSTOMERS_RESTORED_BY_HOUR
 2376       
 2377       FROM
 2378       (
 2379         SELECT
 2380       *
 2381         FROM WORK.CONNECT_BY_SUF
 2382       
 2383         LEFT JOIN
 2384         (
 2385       SELECT
 2386         T1.CREATION_INTERVAL AS CREATION_INTERVAL
 2387         ,COUNT(T1.OMS_LOCATION_ID) AS NEW_INCIDENTS
 2388         ,SUM(T1.TTL_CUST_OUT) AS NEW_CUSTOMERS_OUT
 2389       FROM WORK.QRYSTORM_FMT_DATES T1
 2390       WHERE CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS)
 2390     !  NOT IN ('CANCELLED', 'PLANNED') AND DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 2391       GROUP BY T1.CREATION_INTERVAL
 2392         ) T1
 2393         ON DATE_INTERVAL = T1.CREATION_INTERVAL
 2394       
 2395         LEFT JOIN
 2396         (
 2397       SELECT
 2398         RESTORED_DURING_INTERVAL
 2399         ,INCIDENTS_RESTORED_BY_HOUR
 2400         ,SUM(INCIDENTS_RESTORED_BY_HOUR) AS RT_INCIDENTS_RESTORED
 2401         ,CUSTOMERS_RESTORED_BY_HOUR
 2402         ,SUM(CUSTOMERS_RESTORED_BY_HOUR) AS RT_CUSTOMERS_RESTORED
 2403       FROM
 2404       (
 2405         SELECT
 2406       RESTORED_DURING_INTERVAL
 2407       ,COUNT(OMS_LOCATION_ID) AS INCIDENTS_RESTORED_BY_HOUR
 2408       ,SUM(TTL_CUST_OUT) AS CUSTOMERS_RESTORED_BY_HOUR
 2409         FROM WORK.QRYSTORM_FMT_DATES
 2410         WHERE
 2411         (
 2412       CALL_TYPE IN ('OUT') AND JOB_TYPE NOT IN ('CANC','CANS','CAND','CANE','CAN','CANO','CANT') AND UPPER(CREW_STATUS) NOT
 2412     ! IN ('CANCELLED', 'PLANNED') AND DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 2413       AND RESTORED_DURING_INTERVAL IS NOT NULL
 2414         )
 2415         GROUP BY RESTORED_DURING_INTERVAL
 2416       )
 2417       GROUP BY RESTORED_DURING_INTERVAL
 2418       ) T2
 2419       ON DATE_INTERVAL = T2.RESTORED_DURING_INTERVAL
 2420         )
 2421         GROUP BY DATE_INTERVAL
 2422         ORDER BY DATE_INTERVAL;
 NOTE: A GROUP BY clause has been discarded because neither the SELECT clause nor the optional HAVING clause of the associated 
       table-expression referenced a summary function.
 NOTE: The query requires remerging summary statistics back with the original data.
 NOTE: Table WORK.CONNECT_BY2_SUF created, with 251 rows and 7 columns.
 
 2423       
 2424       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.02 seconds
       cpu time            0.02 seconds
       
 
 2425       
 2426       DATA GET_RUNNING_TTLS_SUF;
 2427         SET WORK.CONNECT_BY2_SUF;
 2428         RT_OF_INCIDENTS+NEW_INCIDENTS;
 2429         RT_OF_CUSTOMERS_OUT+NEW_CUSTOMERS_OUT;
 2430         RT_INCIDENTS_RESTORED+INCIDENTS_RESTORED_BY_HOUR;
 2431         RT_CUSTOMERS_RESTORED+CUSTOMERS_RESTORED_BY_HOUR;
 2432       RUN;
 
 NOTE: There were 251 observations read from the data set WORK.CONNECT_BY2_SUF.
 NOTE: The data set WORK.GET_RUNNING_TTLS_SUF has 251 observations and 11 variables.

 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2433       
 2434       PROC SQL;
 2435       CREATE TABLE WORK.QRYHOURLY_TOTALS_SUF AS
 2436       SELECT
 2437         ('6 - SUFFOLK') AS DIVISION
 2438         ,DATE_INTERVALFORMAT=NLDATML20.
 2439         ,((intnx("HOUR",DATE_INTERVAL,+1))) FORMAT=NLDATML20. AS INTERVAL_TO
 2440         /*,CREATION_INTERVAL*/
 2441         ,NEW_INCIDENTS
 2442         ,RT_OF_INCIDENTS
 2443         ,NEW_CUSTOMERS_OUT
 2444         ,RT_OF_CUSTOMERS_OUT
 2445         /*,RESTORED_DURING_INTERVAL*/
 2446         ,INCIDENTS_RESTORED_BY_HOUR
 2447         ,RT_INCIDENTS_RESTORED
 2448         ,CUSTOMERS_RESTORED_BY_HOUR
 2449         ,RT_CUSTOMERS_RESTORED
 2450         ,(RT_OF_INCIDENTS - RT_INCIDENTS_RESTORED) AS RT_INCIDENTS_STILL_OUT
 2451         ,(RT_OF_CUSTOMERS_OUT - RT_CUSTOMERS_RESTORED) AS RT_CUSTOMERS_STILL_OUT
 2452       FROM WORK.GET_RUNNING_TTLS_SUF
 2453       WHERE
 2454       DATE_INTERVAL >= "&gblStartStm"dt
 2455       AND
 2456       /*DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,0))*/
 2457       DATE_INTERVAL <= %sysfunc(intnx(HOUR,"&gblEndStm"dt,-1))
 2458       ORDER BY DATE_INTERVAL;
 NOTE: Table WORK.QRYHOURLY_TOTALS_SUF created, with 249 rows and 13 columns.
 
 2459       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 2460       
 2461       PROC SQL;
 2462       DROP TABLE WORK.CONNECT_BY_SUF;
 NOTE: Table WORK.CONNECT_BY_SUF has been dropped.
 2463       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2464       
 2465       PROC SQL;
 2466       DROP TABLE WORK.CONNECT_BY2_SUF;
 NOTE: Table WORK.CONNECT_BY2_SUF has been dropped.
 2467       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2468       
 2469       PROC DELETE DATA=WORK.GET_RUNNING_TTLS_SUF;
 2470       QUIT;
 
 NOTE: Deleting WORK.GET_RUNNING_TTLS_SUF (memtype=DATA).
 NOTE: PROCEDURE DELETE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2471       
 2472       
 2473       /* ********************************************** SUFFOLK HOURLY DATA ********************************************** */
 2474       
 2475       
 2476       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2477       
 2478       
 2479       PROC SQL;
 2480       CREATE TABLE WORK.QV_APPEND_ALL_DIVS55 AS
 2481       SELECT * FROM WORK.QV_HOURLY_TOTALS55
 2482        OUTER UNION CORR
 2483       SELECT * FROM WORK.QRYHOURLY_TOTALS_QN
 2484        OUTER UNION CORR
 2485       SELECT * FROM WORK.QRYHOURLY_TOTALS_CN
 2486        OUTER UNION CORR
 2487       SELECT * FROM WORK.QRYHOURLY_TOTALS_WS
 2488        OUTER UNION CORR
 2489       SELECT * FROM WORK.QRYHOURLY_TOTALS_ES
 2490        OUTER UNION CORR
 2491       SELECT * FROM WORK.QRYHOURLY_TOTALS_NAS
 2492        OUTER UNION CORR
 2493       SELECT * FROM WORK.QRYHOURLY_TOTALS_SUF
 2494       ;
 NOTE: Table WORK.QV_APPEND_ALL_DIVS55 created, with 1743 rows and 13 columns.
 
 2495       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 2496       
 2497       
 2498       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2499       
 2500       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2501       
 2502       
 2503       
 2504       PROC SQL;
 2505          CREATE TABLE WORK.qryDispatchedVsNot_ALL AS
 2506          SELECT
 2507          ('0 - PSEGLI ALL') AS DIVISION
 2508          ,t1.JOB_STATUS
 2509                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2510                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2511             FROM WORK.QRYSTORM_FMT_DATES t1
 2512             WHERE t1.CALL_TYPE IN
 2513                  (
 2514                  'OUT'
 2515                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL
 2516             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_ALL created, with 2 rows and 4 columns.
 
 2517       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2518       
 2519       PROC SQL;
 2520          CREATE TABLE WORK.qryDispatchedVsNot_QN AS
 2521          SELECT
 2522          ('1 - Queens, Nas.') AS DIVISION
 2523          ,t1.JOB_STATUS
 2524                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2525                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2526             FROM WORK.QRYSTORM_FMT_DATES t1
 2527             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 2527     ! t1.JOB_STATUS IS NOT NULL AND t1.DISTRICT IN ('1 - Queens, Nas.')
 2528             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_QN created, with 1 rows and 4 columns.
 
 2529       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2530       
 2531       PROC SQL;
 2532          CREATE TABLE WORK.qryDispatchedVsNot_CN AS
 2533          SELECT
 2534          ('2 - Central, Nas.') AS DIVISION
 2535          ,t1.JOB_STATUS
 2536                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2537                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2538             FROM WORK.QRYSTORM_FMT_DATES t1
 2539             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 2539     ! t1.JOB_STATUS IS NOT NULL AND t1.DISTRICT IN ('2 - Central, Nas.')
 2540             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_CN created, with 1 rows and 4 columns.
 
 2541       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2542       
 2543       PROC SQL;
 2544          CREATE TABLE WORK.qryDispatchedVsNot_WS AS
 2545          SELECT
 2546          ('3 - Western, Suf.') AS DIVISION
 2547          ,t1.JOB_STATUS
 2548                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2549                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2550             FROM WORK.QRYSTORM_FMT_DATES t1
 2551             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 2551     ! t1.JOB_STATUS IS NOT NULL AND t1.DISTRICT IN ('3 - Western, Suf.')
 2552             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_WS created, with 2 rows and 4 columns.
 
 2553       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2554       
 2555       PROC SQL;
 2556          CREATE TABLE WORK.qryDispatchedVsNot_ES AS
 2557          SELECT
 2558          ('4 - Eastern, Suf.') AS DIVISION
 2559          ,t1.JOB_STATUS
 2560                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2561                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2562             FROM WORK.QRYSTORM_FMT_DATES t1
 2563             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 2563     ! t1.JOB_STATUS IS NOT NULL AND t1.DISTRICT IN ('4 - Eastern, Suf.')
 2564             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_ES created, with 2 rows and 4 columns.
 
 2565       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2566       
 2567       PROC SQL;
 2568          CREATE TABLE WORK.qryDispatchedVsNot_NAS AS
 2569          SELECT
 2570          ('5 - NASSAU') AS DIVISION
 2571          ,t1.JOB_STATUS
 2572                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2573                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2574             FROM WORK.QRYSTORM_FMT_DATES t1
 2575             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 2575     ! t1.JOB_STATUS IS NOT NULL AND t1.DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 2576             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_NAS created, with 1 rows and 4 columns.
 
 2577       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2578       
 2579       PROC SQL;
 2580          CREATE TABLE WORK.qryDispatchedVsNot_SUF AS
 2581          SELECT
 2582          ('6 - SUFFOLK') AS DIVISION
 2583          ,t1.JOB_STATUS
 2584                   ,(COUNT(t1.JOB_STATUS)) AS TTL_JOBS
 2585                   ,(SUM(t1.TTL_CUST_OUT)) AS TTL_CUST_OUT
 2586             FROM WORK.QRYSTORM_FMT_DATES t1
 2587             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 2587     ! t1.JOB_STATUS IS NOT NULL AND t1.DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 2588             GROUP BY t1.JOB_STATUS;
 NOTE: Table WORK.QRYDISPATCHEDVSNOT_SUF created, with 2 rows and 4 columns.
 
 2589       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2590       
 2591       
 2592       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2593       
 2594       
 2595       PROC SQL;
 2596       CREATE TABLE WORK.QV_DispatchedVsNot55 AS
 2597       SELECT * FROM WORK.qryDispatchedVsNot_ALL
 2598        OUTER UNION CORR
 2599       SELECT * FROM WORK.qryDispatchedVsNot_QN
 2600        OUTER UNION CORR
 2601       SELECT * FROM WORK.qryDispatchedVsNot_CN
 2602        OUTER UNION CORR
 2603       SELECT * FROM WORK.qryDispatchedVsNot_WS
 2604        OUTER UNION CORR
 2605       SELECT * FROM WORK.qryDispatchedVsNot_ES
 2606        OUTER UNION CORR
 2607       SELECT * FROM WORK.qryDispatchedVsNot_NAS
 2608        OUTER UNION CORR
 2609       SELECT * FROM WORK.qryDispatchedVsNot_SUF
 2610       ;
 NOTE: Table WORK.QV_DISPATCHEDVSNOT55 created, with 11 rows and 4 columns.
 
 2611       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2612       
 2613       
 2614       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2615       
 2616       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2617       
 2618       
 2619       
 2620       
 2621       libname oralib1 oracle path="(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = gcxp1-scan.livdc.local)(PORT = 1521))
 2622       (CONNECT_DATA = (SERVICE_NAME=ohprd)))" user=oh password=XX schema=oh;
 NOTE: Libref ORALIB1 was successfully assigned as follows: 
       Engine:        ORACLE 
       Physical Name: (DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = gcxp1-scan.livdc.local)(PORT = 1521))(CONNECT_DATA = 
       (SERVICE_NAME=ohprd)))
 2623       
 2624       PROC SQL NOPRINT;
 2625       CREATE TABLE WORK.QRY_LOCATIONIDS_DASH AS
 2626       
 2627          SELECT
 2628          t1.OMS_LOCATION_ID
 2629             FROM WORK.QRYSTORM_FMT_DATES t1
 2630             WHERE CALL_TYPE IN ('OUT') AND (ENERGT IS NULL OR ENERGT IS MISSING) AND TTL_CUST_OUT > 0;
 NOTE: Table WORK.QRY_LOCATIONIDS_DASH created, with 12 rows and 1 columns.
 
 2631       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2632       
 2633       proc sql;
 2634         DROP TABLE oralib1.TEMP_LOCATIONIDS_DASH;
 NOTE: Table ORALIB1.TEMP_LOCATIONIDS_DASH has been dropped.
 2635       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.15 seconds
       cpu time            0.01 seconds
       
 
 2636       
 2637       proc sql NOPRINT;
 2638       /* CONNECT TO ORACLE(user=OH6 password=OH6 path='gcxp1-scan.livdc.local:1521/omscad6p'); */
 2639       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 2640       
 2641          EXECUTE
 2642          (
 2643          CREATE /*GLOBAL TEMPORARY*/ TABLE TEMP_LOCATIONIDS_DASH
 2644              (OMS_LOCATION_ID NUMBER) /* ON COMMIT PRESERVE ROWS */
 2645       ) BY oracle;
 2646       
 2647       
 2648         INSERT INTO oralib1.TEMP_LOCATIONIDS_DASH SELECT * FROM WORK.QRY_LOCATIONIDS_DASH;
 NOTE: 12 rows were inserted into ORALIB1.TEMP_LOCATIONIDS_DASH.
 
 2649       
 2650         /*SELECT * FROM CONNECTION to ORACLE(SELECT * from TEMP_LOCATIONIDS_DASH)*/;
 2651       
 2652       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.36 seconds
       cpu time            0.01 seconds
       

 
 2653       
 2654       libname oralib1 clear;
 NOTE: Libref ORALIB1 has been deassigned.
 2655       
 2656       PROC SQL /*OUTOBS=10*/;
 2657       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 2658       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 2659       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 2659     ! */
 2660       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 2660     ! PROD 67 HN */
 2661       EXECUTE
 2662       (
 2663       
 2664       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 2665       
 2666       ) BY ORACLE;
 2667       CREATE TABLE WORK.GETCUROUTBYVLG_DASH AS
 2668       SELECT * FROM CONNECTION TO ORACLE
 2669       (
 2670         SELECT
 2671         DISTRICT
 2672       ,VILLAGE
 2673       ,COUNT(INCIDENTS_OUT) AS INCIDENTS_OUT
 2674       ,SUM(CUSTOMERS_OUT) AS CUSTOMERS_OUT
 2675         FROM
 2676         (
 2677         SELECT
 2678         IVR_CITY_NAME AS VILLAGE
 2679       ,LOC_DISTRICT AS DISTRICT
 2680       ,(CDP_LOCATION_ID) AS INCIDENTS_OUT
 2681       ,COUNT(CDP_PREMISE_CUSTNO_ID) AS CUSTOMERS_OUT
 2682         FROM
 2683         (
 2684       
 2685         SELECT
 2686       CDP_PREMISE_CUSTNO_ID
 2687       ,LOC_DISTRICT
 2688       ,CDP_LOCATION_ID
 2689       ,IVR_CITY_NAME
 2690         FROM
 2691         (
 2692         SELECT DISTINCT
 2693             PREMISE_CUSTNO_ID AS CDP_PREMISE_CUSTNO_ID
 2694             ,LOCATION_ID AS CDP_LOCATION_ID
 2695           FROM INCIDENT_DEVICE_PREMISE@OMS_LINK.WORLD CDP
 2696         WHERE LOCATION_ID IN (SELECT OMS_LOCATION_ID FROM TEMP_LOCATIONIDS_DASH)
 2697         )
 2698       
 2699         LEFT JOIN
 2700             (
 2701           SELECT
 2702               LOCATION_ID AS LOC_LOCATION_ID
 2703         ,DECODE(DIST_NO,1,'1 - Queens, Nas.',2,'2 - Central, Nas.',3,'3 - Western, Suf.',4,'4 - Eastern, Suf.','Unknown
 2703     ! District') AS LOC_DISTRICT
 2704           FROM LOCATION@OMS_LINK.WORLD
 2705             ) LOC
 2706             ON CDP_LOCATION_ID = LOC.LOC_LOCATION_ID
 2707       
 2708         LEFT JOIN
 2709         (
 2710       SELECT DISTINCT
 2711           CITY_NAM AS IVR_CITY_NAME
 2712           ,PREMISE_CUSTNO_ID AS IVR_PREMISE_ID
 2713           ,CUST_NAM AS IVR_CUST_NAME
 2714               ,PHONE_NUM AS IVR_HOME_PHONE
 2715               ,WORK_PHONE_NUM AS IVR_WORK_PHONE
 2716           ,CONTACT_PHONE_NUM AS IVR_CONTACT_PHONE
 2717        FROM PREMISE_IVR@OMS_LINK.WORLD
 2718         ) IVR
 2719         ON CDP_PREMISE_CUSTNO_ID = IVR.IVR_PREMISE_ID
 2720       
 2721         LEFT JOIN PREMISE@OMS_LINK.WORLD PREM ON CDP_PREMISE_CUSTNO_ID = PREM.PREMISE_CUSTNO_ID
 2722       
 2723         LEFT JOIN PREMISE_UDF@OMS_LINK.WORLD PREMUDF ON PREM.PREMISE_CUSTNO_ID = PREMUDF.PREMISE_CUSTNO_ID
 2724       
 2725         WHERE CUST_TYPE_CD IN ('1', '2')
 2726       
 2727       )
 2728         GROUP BY IVR_CITY_NAME, LOC_DISTRICT, CDP_LOCATION_ID
 2729         ORDER BY CUSTOMERS_OUT DESC, IVR_CITY_NAME ASC
 2730       )
 2731         GROUP BY VILLAGE, DISTRICT
 2732         ORDER BY CUSTOMERS_OUT DESC, VILLAGE ASC
 2733        );
 NOTE: Table WORK.GETCUROUTBYVLG_DASH created, with 13 rows and 4 columns.
 
 2734       DISCONNECT FROM ORACLE;
 2735       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.46 seconds
       cpu time            0.01 seconds
       
 
 2736       
 2737       
 2738       PROC SQL OUTOBS=5 NOWARN;
 2739          CREATE TABLE WORK.GETCUROUTBYVLG_ALL AS
 2740          SELECT
 2741          ('0 - PSEGLI ALL') AS DIVISION
 2742          ,t1.VILLAGE
 2743                   ,t1.INCIDENTS_OUT
 2744                   ,t1.CUSTOMERS_OUT
 2745             FROM WORK.GETCUROUTBYVLG_DASH t1
 2746             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;
 NOTE: Table WORK.GETCUROUTBYVLG_ALL created, with 5 rows and 4 columns.
 
 2747       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2748       
 2749       PROC SQL OUTOBS=5 NOWARN;
 2750          CREATE TABLE WORK.GETCUROUTBYVLG_QN AS
 2751          SELECT
 2752          ('1 - Queens, Nas.') AS DIVISION
 2753          ,t1.VILLAGE
 2754                   ,t1.INCIDENTS_OUT
 2755                   ,t1.CUSTOMERS_OUT
 2756             FROM WORK.GETCUROUTBYVLG_DASH t1
 2757             WHERE t1.DISTRICT IN ('1 - Queens, Nas.')
 2758             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;
 NOTE: Table WORK.GETCUROUTBYVLG_QN created, with 1 rows and 4 columns.
 
 2759       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2760       
 2761       PROC SQL OUTOBS=5 NOWARN;
 2762          CREATE TABLE WORK.GETCUROUTBYVLG_CN AS
 2763          SELECT
 2764          ('2 - Central, Nas.') AS DIVISION
 2765          ,t1.VILLAGE
 2766                   ,t1.INCIDENTS_OUT
 2767                   ,t1.CUSTOMERS_OUT
 2768             FROM WORK.GETCUROUTBYVLG_DASH t1
 2769             WHERE t1.DISTRICT IN ('2 - Central, Nas.')
 2770             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;
 NOTE: Table WORK.GETCUROUTBYVLG_CN created, with 3 rows and 4 columns.
 
 2771       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2772       
 2773       PROC SQL OUTOBS=5 NOWARN;
 2774          CREATE TABLE WORK.GETCUROUTBYVLG_WS AS
 2775          SELECT
 2776          ('3 - Western, Suf.') AS DIVISION
 2777          ,t1.VILLAGE
 2778                   ,t1.INCIDENTS_OUT
 2779                   ,t1.CUSTOMERS_OUT
 2780             FROM WORK.GETCUROUTBYVLG_DASH t1
 2781             WHERE t1.DISTRICT IN ('3 - Western, Suf.')
 2782             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;
 NOTE: Table WORK.GETCUROUTBYVLG_WS created, with 5 rows and 4 columns.
 
 2783       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2784       
 2785       PROC SQL OUTOBS=5 NOWARN;
 2786          CREATE TABLE WORK.GETCUROUTBYVLG_ES AS
 2787          SELECT
 2788          ('4 - Eastern, Suf.') AS DIVISION
 2789          ,t1.VILLAGE
 2790                   ,t1.INCIDENTS_OUT
 2791                   ,t1.CUSTOMERS_OUT
 2792             FROM WORK.GETCUROUTBYVLG_DASH t1
 2793             WHERE t1.DISTRICT IN ('4 - Eastern, Suf.')
 2794             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;
 NOTE: Table WORK.GETCUROUTBYVLG_ES created, with 2 rows and 4 columns.
 
 2795       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2796       
 2797       PROC SQL OUTOBS=5 NOWARN;
 2798          CREATE TABLE WORK.GETCUROUTBYVLG_NAS AS
 2799          SELECT
 2800          ('5 - NASSAU') AS DIVISION
 2801          ,t1.VILLAGE
 2802                   ,t1.INCIDENTS_OUT
 2803                   ,t1.CUSTOMERS_OUT
 2804             FROM WORK.GETCUROUTBYVLG_DASH t1
 2805             WHERE t1.DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 2806             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;

 NOTE: Table WORK.GETCUROUTBYVLG_NAS created, with 4 rows and 4 columns.
 
 2807       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2808       
 2809       PROC SQL OUTOBS=5 NOWARN;
 2810          CREATE TABLE WORK.GETCUROUTBYVLG_SUF AS
 2811          SELECT
 2812          ('6 - SUFFOLK') AS DIVISION
 2813          ,t1.VILLAGE
 2814                   ,t1.INCIDENTS_OUT
 2815                   ,t1.CUSTOMERS_OUT
 2816             FROM WORK.GETCUROUTBYVLG_DASH t1
 2817             WHERE t1.DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 2818             ORDER BY t1.CUSTOMERS_OUT DESC, t1.VILLAGE ASC;
 NOTE: Table WORK.GETCUROUTBYVLG_SUF created, with 5 rows and 4 columns.
 
 2819       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2820       
 2821       
 2822       
 2823       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2824       
 2825       
 2826       PROC SQL;
 2827       CREATE TABLE WORK.QV_GETCUROUTBYVLG55 AS
 2828       SELECT * FROM WORK.GETCUROUTBYVLG_ALL
 2829        OUTER UNION CORR
 2830       SELECT * FROM WORK.GETCUROUTBYVLG_QN
 2831        OUTER UNION CORR
 2832       SELECT * FROM WORK.GETCUROUTBYVLG_CN
 2833        OUTER UNION CORR
 2834       SELECT * FROM WORK.GETCUROUTBYVLG_WS
 2835        OUTER UNION CORR
 2836       SELECT * FROM WORK.GETCUROUTBYVLG_ES
 2837        OUTER UNION CORR
 2838       SELECT * FROM WORK.GETCUROUTBYVLG_NAS
 2839        OUTER UNION CORR
 2840       SELECT * FROM WORK.GETCUROUTBYVLG_SUF
 2841       ORDER BY DIVISION ASC, CUSTOMERS_OUT DESC, VILLAGE ASC;
 NOTE: Table WORK.QV_GETCUROUTBYVLG55 created, with 25 rows and 4 columns.
 
 2842       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2843       
 2844       
 2845       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2846       
 2847       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 2848       
 2849       
 2850       
 2851       
 2852       /* ********************************************** GET LSE CUST OUT ********************************************** */
 2853       
 2854       PROC SQL /*OUTOBS=10*/;
 2855       CONNECT TO ORACLE(user=oh password=XX path='gcxp1-scan.livdc.local:1521/ohprd');
 2856       /*CONNECT TO ORACLE(user=oh6 password=oh6 path='gcxp2-scan.livdc.local:1521/ohtst'); */ /* #connect to test oh67 */
 2857       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='hnxp1-scan.livdc.local:1521/haomscad6t'); */ /* #connect TO TEST 67 HN
 2857     ! */
 2858       /*CONNECT TO ORACLE(user=OH6 password=OH6 path='OMSCAD6PReadDBScan.psegliny.com:1521/HAOMSCAD6P'); */ /* #CONNECT TO
 2858     ! PROD 67 HN */
 2859       EXECUTE
 2860       (
 2861       
 2862       ALTER SESSION SET NLS_DATE_FORMAT = 'MM/DD/YYYY HH24:MI:SS'
 2863       
 2864       ) BY ORACLE;
 2865       CREATE TABLE WORK.GETLSECUSTOUT_DASH AS
 2866       SELECT * FROM CONNECTION TO ORACLE
 2867       (
 2868         SELECT
 2869       LOC_DISTRICT
 2870       ,CDP_LOCATION_ID
 2871       ,PREM.KEY_CUST_FLG
 2872       ,CDP_PREMISE_CUSTNO_ID
 2873       ,IVR_CUST_NAME
 2874       ,IVR_CITY_NAME
 2875         FROM
 2876         (
 2877         SELECT DISTINCT
 2878             PREMISE_CUSTNO_ID AS CDP_PREMISE_CUSTNO_ID
 2879             ,LOCATION_ID AS CDP_LOCATION_ID
 2880           FROM INCIDENT_DEVICE_PREMISE@OMS_LINK.WORLD CDP
 2881         WHERE LOCATION_ID IN (SELECT OMS_LOCATION_ID FROM TEMP_LOCATIONIDS_DASH)
 2882         )
 2883       
 2884         LEFT JOIN
 2885             (
 2886           SELECT
 2887               LOCATION_ID AS LOC_LOCATION_ID
 2888         ,DECODE(DIST_NO,1,'1 - Queens, Nas.',2,'2 - Central, Nas.',3,'3 - Western, Suf.',4,'4 - Eastern, Suf.','Unknown
 2888     ! District') AS LOC_DISTRICT
 2889           FROM LOCATION@OMS_LINK.WORLD
 2890             ) LOC
 2891             ON CDP_LOCATION_ID = LOC.LOC_LOCATION_ID
 2892       
 2893         LEFT JOIN
 2894         (
 2895       SELECT DISTINCT
 2896           CITY_NAM AS IVR_CITY_NAME
 2897           ,PREMISE_CUSTNO_ID AS IVR_PREMISE_ID
 2898           ,CUST_NAM AS IVR_CUST_NAME
 2899               ,PHONE_NUM AS IVR_HOME_PHONE
 2900               ,WORK_PHONE_NUM AS IVR_WORK_PHONE
 2901           ,CONTACT_PHONE_NUM AS IVR_CONTACT_PHONE
 2902        FROM PREMISE_IVR@OMS_LINK.WORLD
 2903         ) IVR
 2904         ON CDP_PREMISE_CUSTNO_ID = IVR.IVR_PREMISE_ID
 2905       
 2906         LEFT JOIN PREMISE@OMS_LINK.WORLD PREM ON CDP_PREMISE_CUSTNO_ID = PREM.PREMISE_CUSTNO_ID
 2907       
 2908         LEFT JOIN PREMISE_UDF@OMS_LINK.WORLD PREMUDF ON PREM.PREMISE_CUSTNO_ID = PREMUDF.PREMISE_CUSTNO_ID
 2909       
 2910         WHERE CUST_TYPE_CD IN ('1', '2') /*AND KEY_CUST_FLG IN ('13')*/
 2911        );
 NOTE: Table WORK.GETLSECUSTOUT_DASH created, with 182 rows and 6 columns.
 
 2912       DISCONNECT FROM ORACLE;
 2913       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.34 seconds
       cpu time            0.02 seconds
       
 
 2914       
 2915       
 2916       PROC SQL;
 2917          CREATE TABLE WORK.GETLSECUSTOUT_ALL AS
 2918          SELECT
 2919          ('0 - PSEGLI ALL') AS DIVISION
 2920       ,CDP_LOCATION_ID
 2921       ,KEY_CUST_FLG
 2922       ,CDP_PREMISE_CUSTNO_ID
 2923       ,IVR_CUST_NAME
 2924       ,IVR_CITY_NAME
 2925             FROM WORK.GETLSECUSTOUT_DASH t1
 2926             WHERE KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_ALL created, with 0 rows and 6 columns.
 
 2927       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2928       
 2929       PROC SQL;
 2930          CREATE TABLE WORK.GETLSECUSTOUT_QN AS
 2931          SELECT
 2932          ('1 - Queens, Nas.') AS DIVISION
 2933       ,CDP_LOCATION_ID
 2934       ,KEY_CUST_FLG
 2935       ,CDP_PREMISE_CUSTNO_ID
 2936       ,IVR_CUST_NAME
 2937       ,IVR_CITY_NAME
 2938             FROM WORK.GETLSECUSTOUT_DASH t1
 2939             WHERE t1.LOC_DISTRICT IN ('1 - Queens, Nas.') AND KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_QN created, with 0 rows and 6 columns.
 
 2940       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2941       
 2942       PROC SQL;
 2943          CREATE TABLE WORK.GETLSECUSTOUT_CN AS
 2944          SELECT
 2945          ('2 - Central, Nas.') AS DIVISION
 2946       ,CDP_LOCATION_ID
 2947       ,KEY_CUST_FLG
 2948       ,CDP_PREMISE_CUSTNO_ID
 2949       ,IVR_CUST_NAME
 2950       ,IVR_CITY_NAME
 2951             FROM WORK.GETLSECUSTOUT_DASH t1
 2952             WHERE t1.LOC_DISTRICT IN ('2 - Central, Nas.') AND KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_CN created, with 0 rows and 6 columns.
 
 2953       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2954       
 2955       PROC SQL;
 2956          CREATE TABLE WORK.GETLSECUSTOUT_WS AS
 2957          SELECT
 2958          ('3 - Western, Suf.') AS DIVISION
 2959       ,CDP_LOCATION_ID
 2960       ,KEY_CUST_FLG
 2961       ,CDP_PREMISE_CUSTNO_ID
 2962       ,IVR_CUST_NAME
 2963       ,IVR_CITY_NAME
 2964             FROM WORK.GETLSECUSTOUT_DASH t1
 2965             WHERE t1.LOC_DISTRICT IN ('3 - Western, Suf.') AND KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_WS created, with 0 rows and 6 columns.
 
 2966       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2967       
 2968       PROC SQL;
 2969          CREATE TABLE WORK.GETLSECUSTOUT_ES AS
 2970          SELECT
 2971          ('4 - Eastern, Suf.') AS DIVISION
 2972       ,CDP_LOCATION_ID
 2973       ,KEY_CUST_FLG
 2974       ,CDP_PREMISE_CUSTNO_ID
 2975       ,IVR_CUST_NAME
 2976       ,IVR_CITY_NAME
 2977             FROM WORK.GETLSECUSTOUT_DASH t1
 2978             WHERE t1.LOC_DISTRICT IN ('4 - Eastern, Suf.') AND KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_ES created, with 0 rows and 6 columns.
 
 2979       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 2980       
 2981       PROC SQL;
 2982          CREATE TABLE WORK.GETLSECUSTOUT_NAS AS
 2983          SELECT
 2984          ('5 - NASSAU') AS DIVISION
 2985       ,CDP_LOCATION_ID
 2986       ,KEY_CUST_FLG
 2987       ,CDP_PREMISE_CUSTNO_ID
 2988       ,IVR_CUST_NAME
 2989       ,IVR_CITY_NAME
 2990             FROM WORK.GETLSECUSTOUT_DASH t1
 2991             WHERE t1.LOC_DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.') AND KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_NAS created, with 0 rows and 6 columns.
 
 2992       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 2993       
 2994       PROC SQL;
 2995          CREATE TABLE WORK.GETLSECUSTOUT_SUF AS
 2996          SELECT
 2997          ('6 - SUFFOLK') AS DIVISION
 2998       ,CDP_LOCATION_ID
 2999       ,KEY_CUST_FLG
 3000       ,CDP_PREMISE_CUSTNO_ID
 3001       ,IVR_CUST_NAME
 3002       ,IVR_CITY_NAME
 3003             FROM WORK.GETLSECUSTOUT_DASH t1
 3004             WHERE t1.LOC_DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.') AND KEY_CUST_FLG IN ('13');
 NOTE: Table WORK.GETLSECUSTOUT_SUF created, with 0 rows and 6 columns.
 
 3005       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3006       
 3007       
 3008       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3009       
 3010       
 3011       PROC SQL;
 3012       CREATE TABLE WORK.QV_GETLSECUSTOUT55 AS
 3013       SELECT * FROM WORK.GETLSECUSTOUT_ALL
 3014        OUTER UNION CORR
 3015       SELECT * FROM WORK.GETLSECUSTOUT_QN
 3016        OUTER UNION CORR
 3017       SELECT * FROM WORK.GETLSECUSTOUT_CN
 3018        OUTER UNION CORR
 3019       SELECT * FROM WORK.GETLSECUSTOUT_WS
 3020        OUTER UNION CORR
 3021       SELECT * FROM WORK.GETLSECUSTOUT_ES
 3022        OUTER UNION CORR
 3023       SELECT * FROM WORK.GETLSECUSTOUT_NAS
 3024        OUTER UNION CORR
 3025       SELECT * FROM WORK.GETLSECUSTOUT_SUF
 3026       ORDER BY DIVISION ASC, IVR_CITY_NAME ASC, IVR_CUST_NAME ASC;
 NOTE: Table WORK.QV_GETLSECUSTOUT55 created, with 0 rows and 6 columns.
 
 3027       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 3028       
 3029       
 3030       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3031       
 3032       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3033       
 3034       
 3035       PROC SQL;
 3036          CREATE TABLE WORK.GETCRITCUSTOUT_ALL AS
 3037          SELECT
 3038          ('0 - PSEGLI ALL') AS DIVISION
 3039       ,CDP_LOCATION_ID
 3040       ,KEY_CUST_FLG
 3041       ,CDP_PREMISE_CUSTNO_ID
 3042       ,IVR_CUST_NAME
 3043       ,IVR_CITY_NAME
 3044             FROM WORK.GETLSECUSTOUT_DASH t1
 3045             WHERE KEY_CUST_FLG IN ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '14', '15', '16',
 3045     ! '17');
 NOTE: Table WORK.GETCRITCUSTOUT_ALL created, with 0 rows and 6 columns.
 
 3046       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3047       
 3048       PROC SQL;
 3049          CREATE TABLE WORK.GETCRITCUSTOUT_QN AS
 3050          SELECT
 3051          ('1 - Queens, Nas.') AS DIVISION
 3052       ,CDP_LOCATION_ID
 3053       ,KEY_CUST_FLG
 3054       ,CDP_PREMISE_CUSTNO_ID
 3055       ,IVR_CUST_NAME
 3056       ,IVR_CITY_NAME
 3057             FROM WORK.GETLSECUSTOUT_DASH t1
 3058             WHERE t1.LOC_DISTRICT IN ('1 - Queens, Nas.') AND KEY_CUST_FLG IN ('01', '02', '03', '04', '05', '06', '07', '08',
 3058     ! '09', '10', '11', '12', '14', '15', '16', '17');
 NOTE: Table WORK.GETCRITCUSTOUT_QN created, with 0 rows and 6 columns.
 
 3059       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3060       
 3061       PROC SQL;
 3062          CREATE TABLE WORK.GETCRITCUSTOUT_CN AS
 3063          SELECT
 3064          ('2 - Central, Nas.') AS DIVISION
 3065       ,CDP_LOCATION_ID
 3066       ,KEY_CUST_FLG
 3067       ,CDP_PREMISE_CUSTNO_ID
 3068       ,IVR_CUST_NAME
 3069       ,IVR_CITY_NAME
 3070             FROM WORK.GETLSECUSTOUT_DASH t1
 3071             WHERE t1.LOC_DISTRICT IN ('2 - Central, Nas.') AND KEY_CUST_FLG IN ('01', '02', '03', '04', '05', '06', '07', '08',
 3071     !  '09', '10', '11', '12', '14', '15', '16', '17');
 NOTE: Table WORK.GETCRITCUSTOUT_CN created, with 0 rows and 6 columns.
 
 3072       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3073       
 3074       PROC SQL;
 3075          CREATE TABLE WORK.GETCRITCUSTOUT_WS AS
 3076          SELECT
 3077          ('3 - Western, Suf.') AS DIVISION
 3078       ,CDP_LOCATION_ID
 3079       ,KEY_CUST_FLG
 3080       ,CDP_PREMISE_CUSTNO_ID
 3081       ,IVR_CUST_NAME
 3082       ,IVR_CITY_NAME
 3083             FROM WORK.GETLSECUSTOUT_DASH t1
 3084             WHERE t1.LOC_DISTRICT IN ('3 - Western, Suf.') AND KEY_CUST_FLG IN ('01', '02', '03', '04', '05', '06', '07', '08',
 3084     !  '09', '10', '11', '12', '14', '15', '16', '17');
 NOTE: Table WORK.GETCRITCUSTOUT_WS created, with 0 rows and 6 columns.
 
 3085       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3086       
 3087       PROC SQL;
 3088          CREATE TABLE WORK.GETCRITCUSTOUT_ES AS
 3089          SELECT
 3090          ('4 - Eastern, Suf.') AS DIVISION
 3091       ,CDP_LOCATION_ID
 3092       ,KEY_CUST_FLG
 3093       ,CDP_PREMISE_CUSTNO_ID
 3094       ,IVR_CUST_NAME
 3095       ,IVR_CITY_NAME
 3096             FROM WORK.GETLSECUSTOUT_DASH t1
 3097             WHERE t1.LOC_DISTRICT IN ('4 - Eastern, Suf.') AND KEY_CUST_FLG IN ('01', '02', '03', '04', '05', '06', '07', '08',
 3097     !  '09', '10', '11', '12', '14', '15', '16', '17');
 NOTE: Table WORK.GETCRITCUSTOUT_ES created, with 0 rows and 6 columns.
 
 3098       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3099       
 3100       PROC SQL;
 3101          CREATE TABLE WORK.GETCRITCUSTOUT_NAS AS
 3102          SELECT
 3103          ('5 - NASSAU') AS DIVISION
 3104       ,CDP_LOCATION_ID
 3105       ,KEY_CUST_FLG
 3106       ,CDP_PREMISE_CUSTNO_ID
 3107       ,IVR_CUST_NAME
 3108       ,IVR_CITY_NAME
 3109             FROM WORK.GETLSECUSTOUT_DASH t1
 3110             WHERE t1.LOC_DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.') AND KEY_CUST_FLG IN ('01', '02', '03', '04',
 3110     ! '05', '06', '07', '08', '09', '10', '11', '12', '14', '15', '16', '17');
 NOTE: Table WORK.GETCRITCUSTOUT_NAS created, with 0 rows and 6 columns.
 
 3111       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3112       
 3113       PROC SQL;
 3114          CREATE TABLE WORK.GETCRITCUSTOUT_SUF AS
 3115          SELECT
 3116          ('6 - SUFFOLK') AS DIVISION
 3117       ,CDP_LOCATION_ID
 3118       ,KEY_CUST_FLG
 3119       ,CDP_PREMISE_CUSTNO_ID
 3120       ,IVR_CUST_NAME
 3121       ,IVR_CITY_NAME
 3122             FROM WORK.GETLSECUSTOUT_DASH t1
 3123             WHERE t1.LOC_DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.') AND KEY_CUST_FLG IN ('01', '02', '03', '04',
 3123     ! '05', '06', '07', '08', '09', '10', '11', '12', '14', '15', '16', '17');
 NOTE: Table WORK.GETCRITCUSTOUT_SUF created, with 0 rows and 6 columns.
 
 3124       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3125       
 3126       
 3127       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3128       
 3129       
 3130       PROC SQL;
 3131       CREATE TABLE WORK.QV_GETCRITCUSTOUT55 AS
 3132       SELECT * FROM WORK.GETCRITCUSTOUT_ALL
 3133        OUTER UNION CORR
 3134       SELECT * FROM WORK.GETCRITCUSTOUT_QN
 3135        OUTER UNION CORR
 3136       SELECT * FROM WORK.GETCRITCUSTOUT_CN
 3137        OUTER UNION CORR
 3138       SELECT * FROM WORK.GETCRITCUSTOUT_WS
 3139        OUTER UNION CORR
 3140       SELECT * FROM WORK.GETCRITCUSTOUT_ES
 3141        OUTER UNION CORR
 3142       SELECT * FROM WORK.GETCRITCUSTOUT_NAS
 3143        OUTER UNION CORR
 3144       SELECT * FROM WORK.GETCRITCUSTOUT_SUF
 3145       ORDER BY DIVISION ASC, IVR_CITY_NAME ASC, IVR_CUST_NAME ASC;
 NOTE: Table WORK.QV_GETCRITCUSTOUT55 created, with 0 rows and 6 columns.
 
 3146       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3147       
 3148       
 3149       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3150       
 3151       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3152       
 3153       
 3154       /* *************************************************** DISPATCH STATUS OF REMAINING
 3154     ! ************************************************************** */
 3155       
 3156       /* ************************************************************** ALL
 3156     ! ************************************************************** */
 3157       
 3158       PROC SQL;
 3159          CREATE TABLE WORK.OutByType_DASH_ALL AS
 3160          SELECT /* OUTAGE_PRIORITY */
 3161         ('0 - PSEGLI ALL') AS DIVISION,
 3162                   (CASE
 3163                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3164                       THEN 'Z-Not Analyzed'
 3165                       ELSE t1.OUTAGE_PRIORITY
 3166                   END) AS OUTAGE_PRIORITY,
 3167                 /* ALL_CUST */
 3168                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3169                 /* ALL_JOBS */
 3170                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3171             FROM WORK.QRYSTORM_FMT_DATES t1
 3172             WHERE t1.CALL_TYPE IN
 3173                  (
 3174                  'OUT'
 3175                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL
 3176             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_ALL created, with 5 rows and 4 columns.
 
 3177       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 3178       
 3179       PROC SQL;
 3180          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_ALL AS
 3181          SELECT /* OUTAGE_PRIORITY */
 3182         ('0 - PSEGLI ALL') AS DIVISION,
 3183                   (CASE
 3184                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3185                       THEN 'Z-Not Analyzed'
 3186                       ELSE t1.OUTAGE_PRIORITY
 3187                   END) AS OUTAGE_PRIORITY,
 3188                 /* NOT_DISPATCH_CUST */
 3189                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3190                 /* NOT_DISPATCH_JOBS */
 3191                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3192             FROM WORK.QRYSTORM_FMT_DATES t1
 3193             WHERE t1.CALL_TYPE IN
 3194                  (
 3195                  'OUT'
 3196                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3196     ! t1.JOB_STATUS IN
 3197                  (
 3198                  'NOT_DISPATCHED'
 3199                  )
 3200             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_ALL created, with 2 rows and 4 columns.
 
 3201       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 3202       
 3203       PROC SQL;
 3204          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_ALL AS
 3205          SELECT
 3206            t1.DIVISION,
 3207            t1.OUTAGE_PRIORITY,
 3208                 t1.ALL_CUST,
 3209                 t1.ALL_JOBS,
 3210                 t2.NOT_DISPATCH_CUST,
 3211                 t2.NOT_DISPATCH_JOBS
 3212             FROM WORK.OUTBYTYPE_DASH_ALL t1
 3213                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_ALL t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3213     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_ALL created, with 5 rows and 6 columns.
 
 3214       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3215       
 3216       /* ************************************************************** QN
 3216     ! ************************************************************** */
 3217       
 3218       PROC SQL;
 3219          CREATE TABLE WORK.OutByType_DASH_QN AS
 3220          SELECT /* OUTAGE_PRIORITY */
 3221         ('1 - Queens, Nas.') AS DIVISION,
 3222                   (CASE
 3223                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3224                       THEN 'Z-Not Analyzed'
 3225                       ELSE t1.OUTAGE_PRIORITY
 3226                   END) AS OUTAGE_PRIORITY,
 3227                 /* ALL_CUST */
 3228                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3229                 /* ALL_JOBS */
 3230                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3231             FROM WORK.QRYSTORM_FMT_DATES t1
 3232             WHERE t1.CALL_TYPE IN
 3233                  (
 3234                  'OUT'
 3235                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3235     ! t1.DISTRICT IN ('1 - Queens, Nas.')
 3236             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_QN created, with 1 rows and 4 columns.
 
 3237       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3238       
 3239       PROC SQL;
 3240          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_QN AS
 3241          SELECT /* OUTAGE_PRIORITY */
 3242         ('1 - Queens, Nas.') AS DIVISION,
 3243                   (CASE
 3244                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3245                       THEN 'Z-Not Analyzed'
 3246                       ELSE t1.OUTAGE_PRIORITY
 3247                   END) AS OUTAGE_PRIORITY,
 3248                 /* NOT_DISPATCH_CUST */
 3249                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3250                 /* NOT_DISPATCH_JOBS */
 3251                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3252             FROM WORK.QRYSTORM_FMT_DATES t1
 3253             WHERE t1.CALL_TYPE IN
 3254                  (
 3255                  'OUT'
 3256                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3256     ! t1.JOB_STATUS IN
 3257                  (
 3258                  'NOT_DISPATCHED'
 3259                  )
 3260                  AND t1.DISTRICT IN ('1 - Queens, Nas.')
 3261             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_QN created, with 0 rows and 4 columns.
 
 3262       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3263       
 3264       PROC SQL;
 3265          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_QN AS
 3266          SELECT
 3267            t1.DIVISION,
 3268            t1.OUTAGE_PRIORITY,
 3269                 t1.ALL_CUST,
 3270                 t1.ALL_JOBS,
 3271                 t2.NOT_DISPATCH_CUST,
 3272                 t2.NOT_DISPATCH_JOBS
 3273             FROM WORK.OUTBYTYPE_DASH_QN t1
 3274                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_QN t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3274     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_QN created, with 1 rows and 6 columns.
 
 3275       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3276       
 3277       /* ************************************************************** CN
 3277     ! ************************************************************** */
 3278       
 3279       PROC SQL;
 3280          CREATE TABLE WORK.OutByType_DASH_CN AS
 3281          SELECT /* OUTAGE_PRIORITY */
 3282         ('2 - Central, Nas.') AS DIVISION,
 3283                   (CASE
 3284                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3285                       THEN 'Z-Not Analyzed'
 3286                       ELSE t1.OUTAGE_PRIORITY
 3287                   END) AS OUTAGE_PRIORITY,
 3288                 /* ALL_CUST */
 3289                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3290                 /* ALL_JOBS */
 3291                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3292             FROM WORK.QRYSTORM_FMT_DATES t1
 3293             WHERE t1.CALL_TYPE IN
 3294                  (
 3295                  'OUT'
 3296                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3296     ! t1.DISTRICT IN ('2 - Central, Nas.')
 3297             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_CN created, with 3 rows and 4 columns.
 
 3298       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3299       
 3300       PROC SQL;
 3301          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_CN AS
 3302          SELECT /* OUTAGE_PRIORITY */
 3303         ('2 - Central, Nas.') AS DIVISION,
 3304                   (CASE
 3305                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3306                       THEN 'Z-Not Analyzed'
 3307                       ELSE t1.OUTAGE_PRIORITY
 3308                   END) AS OUTAGE_PRIORITY,
 3309                 /* NOT_DISPATCH_CUST */
 3310                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3311                 /* NOT_DISPATCH_JOBS */
 3312                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3313             FROM WORK.QRYSTORM_FMT_DATES t1
 3314             WHERE t1.CALL_TYPE IN
 3315                  (
 3316                  'OUT'
 3317                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3317     ! t1.JOB_STATUS IN
 3318                  (
 3319                  'NOT_DISPATCHED'
 3320                  )
 3321                  AND t1.DISTRICT IN ('2 - Central, Nas.')
 3322             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_CN created, with 0 rows and 4 columns.
 
 3323       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3324       
 3325       PROC SQL;
 3326          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_CN AS
 3327          SELECT
 3328            t1.DIVISION,
 3329            t1.OUTAGE_PRIORITY,
 3330                 t1.ALL_CUST,
 3331                 t1.ALL_JOBS,
 3332                 t2.NOT_DISPATCH_CUST,
 3333                 t2.NOT_DISPATCH_JOBS
 3334             FROM WORK.OUTBYTYPE_DASH_CN t1
 3335                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_CN t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3335     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_CN created, with 3 rows and 6 columns.
 
 3336       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3337       
 3338       /* ************************************************************** WS
 3338     ! ************************************************************** */
 3339       
 3340       PROC SQL;
 3341          CREATE TABLE WORK.OutByType_DASH_WS AS
 3342          SELECT /* OUTAGE_PRIORITY */
 3343         ('3 - Western, Suf.') AS DIVISION,
 3344                   (CASE
 3345                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3346                       THEN 'Z-Not Analyzed'
 3347                       ELSE t1.OUTAGE_PRIORITY
 3348                   END) AS OUTAGE_PRIORITY,
 3349                 /* ALL_CUST */
 3350                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3351                 /* ALL_JOBS */
 3352                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3353             FROM WORK.QRYSTORM_FMT_DATES t1
 3354             WHERE t1.CALL_TYPE IN
 3355                  (
 3356                  'OUT'
 3357                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3357     ! t1.DISTRICT IN ('3 - Western, Suf.')
 3358             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_WS created, with 3 rows and 4 columns.
 
 3359       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3360       
 3361       PROC SQL;
 3362          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_WS AS
 3363          SELECT /* OUTAGE_PRIORITY */
 3364         ('3 - Western, Suf.') AS DIVISION,
 3365                   (CASE
 3366                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3367                       THEN 'Z-Not Analyzed'
 3368                       ELSE t1.OUTAGE_PRIORITY
 3369                   END) AS OUTAGE_PRIORITY,
 3370                 /* NOT_DISPATCH_CUST */
 3371                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3372                 /* NOT_DISPATCH_JOBS */
 3373                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3374             FROM WORK.QRYSTORM_FMT_DATES t1
 3375             WHERE t1.CALL_TYPE IN
 3376                  (
 3377                  'OUT'
 3378                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3378     ! t1.JOB_STATUS IN
 3379                  (
 3380                  'NOT_DISPATCHED'
 3381                  )
 3382                  AND t1.DISTRICT IN ('3 - Western, Suf.')
 3383             GROUP BY (CALCULATED OUTAGE_PRIORITY);

 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_WS created, with 2 rows and 4 columns.
 
 3384       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 3385       
 3386       PROC SQL;
 3387          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_WS AS
 3388          SELECT
 3389            t1.DIVISION,
 3390            t1.OUTAGE_PRIORITY,
 3391                 t1.ALL_CUST,
 3392                 t1.ALL_JOBS,
 3393                 t2.NOT_DISPATCH_CUST,
 3394                 t2.NOT_DISPATCH_JOBS
 3395             FROM WORK.OUTBYTYPE_DASH_WS t1
 3396                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_WS t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3396     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_WS created, with 3 rows and 6 columns.
 
 3397       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3398       
 3399       /* ************************************************************** ES
 3399     ! ************************************************************** */
 3400       
 3401       PROC SQL;
 3402          CREATE TABLE WORK.OutByType_DASH_ES AS
 3403          SELECT /* OUTAGE_PRIORITY */
 3404         ('4 - Eastern, Suf.') AS DIVISION,
 3405                   (CASE
 3406                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3407                       THEN 'Z-Not Analyzed'
 3408                       ELSE t1.OUTAGE_PRIORITY
 3409                   END) AS OUTAGE_PRIORITY,
 3410                 /* ALL_CUST */
 3411                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3412                 /* ALL_JOBS */
 3413                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3414             FROM WORK.QRYSTORM_FMT_DATES t1
 3415             WHERE t1.CALL_TYPE IN
 3416                  (
 3417                  'OUT'
 3418                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3418     ! t1.DISTRICT IN ('4 - Eastern, Suf.')
 3419             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_ES created, with 1 rows and 4 columns.
 
 3420       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3421       
 3422       PROC SQL;
 3423          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_ES AS
 3424          SELECT /* OUTAGE_PRIORITY */
 3425         ('4 - Eastern, Suf.') AS DIVISION,
 3426                   (CASE
 3427                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3428                       THEN 'Z-Not Analyzed'
 3429                       ELSE t1.OUTAGE_PRIORITY
 3430                   END) AS OUTAGE_PRIORITY,
 3431                 /* NOT_DISPATCH_CUST */
 3432                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3433                 /* NOT_DISPATCH_JOBS */
 3434                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3435             FROM WORK.QRYSTORM_FMT_DATES t1
 3436             WHERE t1.CALL_TYPE IN
 3437                  (
 3438                  'OUT'
 3439                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3439     ! t1.JOB_STATUS IN
 3440                  (
 3441                  'NOT_DISPATCHED'
 3442                  )
 3443                  AND t1.DISTRICT IN ('4 - Eastern, Suf.')
 3444             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_ES created, with 1 rows and 4 columns.
 
 3445       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3446       
 3447       PROC SQL;
 3448          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_ES AS
 3449          SELECT
 3450            t1.DIVISION,
 3451            t1.OUTAGE_PRIORITY,
 3452                 t1.ALL_CUST,
 3453                 t1.ALL_JOBS,
 3454                 t2.NOT_DISPATCH_CUST,
 3455                 t2.NOT_DISPATCH_JOBS
 3456             FROM WORK.OUTBYTYPE_DASH_ES t1
 3457                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_ES t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3457     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_ES created, with 1 rows and 6 columns.
 
 3458       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3459       
 3460       /* ************************************************************** NAS
 3460     ! ************************************************************** */
 3461       
 3462       PROC SQL;
 3463          CREATE TABLE WORK.OutByType_DASH_NAS AS
 3464          SELECT /* OUTAGE_PRIORITY */
 3465         ('5 - NASSAU') AS DIVISION,
 3466                   (CASE
 3467                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3468                       THEN 'Z-Not Analyzed'
 3469                       ELSE t1.OUTAGE_PRIORITY
 3470                   END) AS OUTAGE_PRIORITY,
 3471                 /* ALL_CUST */
 3472                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3473                 /* ALL_JOBS */
 3474                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3475             FROM WORK.QRYSTORM_FMT_DATES t1
 3476             WHERE t1.CALL_TYPE IN
 3477                  (
 3478                  'OUT'
 3479                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3479     ! t1.DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 3480             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_NAS created, with 4 rows and 4 columns.
 
 3481       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 3482       
 3483       PROC SQL;
 3484          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_NAS AS
 3485          SELECT /* OUTAGE_PRIORITY */
 3486         ('5 - NASSAU') AS DIVISION,
 3487                   (CASE
 3488                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3489                       THEN 'Z-Not Analyzed'
 3490                       ELSE t1.OUTAGE_PRIORITY
 3491                   END) AS OUTAGE_PRIORITY,
 3492                 /* NOT_DISPATCH_CUST */
 3493                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3494                 /* NOT_DISPATCH_JOBS */
 3495                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3496             FROM WORK.QRYSTORM_FMT_DATES t1
 3497             WHERE t1.CALL_TYPE IN
 3498                  (
 3499                  'OUT'
 3500                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3500     ! t1.JOB_STATUS IN
 3501                  (
 3502                  'NOT_DISPATCHED'
 3503                  )
 3504                  AND t1.DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 3505             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_NAS created, with 0 rows and 4 columns.
 
 3506       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3507       
 3508       PROC SQL;
 3509          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_NAS AS
 3510          SELECT
 3511            t1.DIVISION,
 3512            t1.OUTAGE_PRIORITY,
 3513                 t1.ALL_CUST,
 3514                 t1.ALL_JOBS,
 3515                 t2.NOT_DISPATCH_CUST,
 3516                 t2.NOT_DISPATCH_JOBS
 3517             FROM WORK.OUTBYTYPE_DASH_NAS t1
 3518                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_NAS t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3518     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_NAS created, with 4 rows and 6 columns.
 
 3519       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3520       
 3521       /* ************************************************************** SUF
 3521     ! ************************************************************** */
 3522       
 3523       PROC SQL;
 3524          CREATE TABLE WORK.OutByType_DASH_SUF AS
 3525          SELECT /* OUTAGE_PRIORITY */
 3526         ('6 - SUFFOLK') AS DIVISION,
 3527                   (CASE
 3528                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3529                       THEN 'Z-Not Analyzed'
 3530                       ELSE t1.OUTAGE_PRIORITY
 3531                   END) AS OUTAGE_PRIORITY,
 3532                 /* ALL_CUST */
 3533                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST,
 3534                 /* ALL_JOBS */
 3535                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS
 3536             FROM WORK.QRYSTORM_FMT_DATES t1
 3537             WHERE t1.CALL_TYPE IN
 3538                  (
 3539                  'OUT'
 3540                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3540     ! t1.DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 3541             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPE_DASH_SUF created, with 3 rows and 4 columns.
 
 3542       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 3543       
 3544       PROC SQL;
 3545          CREATE TABLE WORK.OutByTypeNOTDisp_DASH_SUF AS
 3546          SELECT /* OUTAGE_PRIORITY */
 3547         ('6 - SUFFOLK') AS DIVISION,
 3548                   (CASE
 3549                     WHEN t1.OUTAGE_PRIORITY IS NULL
 3550                       THEN 'Z-Not Analyzed'
 3551                       ELSE t1.OUTAGE_PRIORITY
 3552                   END) AS OUTAGE_PRIORITY,
 3553                 /* NOT_DISPATCH_CUST */
 3554                   (SUM(t1.TTL_CUST_OUT)) AS NOT_DISPATCH_CUST,
 3555                 /* NOT_DISPATCH_JOBS */
 3556                   (COUNT(t1.CREATION_DATETIME)) AS NOT_DISPATCH_JOBS
 3557             FROM WORK.QRYSTORM_FMT_DATES t1
 3558             WHERE t1.CALL_TYPE IN
 3559                  (
 3560                  'OUT'
 3561                  ) AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND t1.JOB_STATUS IS NOT NULL AND
 3561     ! t1.JOB_STATUS IN
 3562                  (
 3563                  'NOT_DISPATCHED'
 3564                  )
 3565                  AND t1.DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 3566             GROUP BY (CALCULATED OUTAGE_PRIORITY);
 NOTE: Table WORK.OUTBYTYPENOTDISP_DASH_SUF created, with 2 rows and 4 columns.
 
 3567       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3568       
 3569       PROC SQL;
 3570          CREATE TABLE WORK.OutByTypeAllVsNot_DASH_SUF AS
 3571          SELECT
 3572            t1.DIVISION,
 3573            t1.OUTAGE_PRIORITY,
 3574                 t1.ALL_CUST,
 3575                 t1.ALL_JOBS,
 3576                 t2.NOT_DISPATCH_CUST,
 3577                 t2.NOT_DISPATCH_JOBS
 3578             FROM WORK.OUTBYTYPE_DASH_SUF t1
 3579                  LEFT JOIN WORK.OUTBYTYPENOTDISP_DASH_SUF t2 ON (t1.OUTAGE_PRIORITY = t2.OUTAGE_PRIORITY) AND (t1.DIVISION =
 3579     ! t2.DIVISION);
 NOTE: Table WORK.OUTBYTYPEALLVSNOT_DASH_SUF created, with 3 rows and 6 columns.
 
 3580       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3581       
 3582       /* *************************************************** DISPATCH STATUS OF REMAINING
 3582     ! ************************************************************** */
 3583       
 3584       
 3585       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3586       
 3587       
 3588       PROC SQL;
 3589       CREATE TABLE WORK.QV_OutByTypeAllVsNot55 AS
 3590       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_ALL
 3591        OUTER UNION CORR
 3592       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_QN
 3593        OUTER UNION CORR
 3594       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_CN
 3595        OUTER UNION CORR
 3596       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_WS
 3597        OUTER UNION CORR
 3598       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_ES
 3599        OUTER UNION CORR
 3600       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_NAS
 3601        OUTER UNION CORR
 3602       SELECT * FROM WORK.OutByTypeAllVsNot_DASH_SUF
 3603       ORDER BY DIVISION ASC, OUTAGE_PRIORITY ASC;
 NOTE: Table WORK.QV_OUTBYTYPEALLVSNOT55 created, with 20 rows and 6 columns.
 
 3604       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 3605       
 3606       
 3607       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3608       
 3609       
 3610       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 3611       
 3612       
 3613       
 3614       /* ****************************************************** OUTAGES BY REF GROUP
 3614     ! ****************************************************** */
 3615       
 3616       /* ************************************************************** ALL
 3616     ! ************************************************************** */
 3617       
 3618       PROC SQL;
 3619          CREATE TABLE WORK.qryAllJobsCustByRefGrp_ALL AS
 3620          SELECT /* REFERRED_TO */
 3621                   (CASE
 3622                     WHEN t1.REFERRED_TO IS NULL
 3623                       THEN 'OPS'
 3624                        ELSE t1.REFERRED_TO
 3625                   END) AS REFERRED_TO,
 3626                 /* ALL_CUST_OUT */
 3627                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 3628                 /* ALL_JOBS_OUT */
 3629                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 3630             FROM WORK.QRYSTORM_FMT_DATES t1
 3631             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0
 3632             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_ALL created, with 1 rows and 3 columns.
 
 3633       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3634       
 3635       proc sql;
 3636          create table WORK.TBLREFGROUPS_ALL
 3637          (
 3638       CODE char(12),
 3639               DESC char(50),
 3640               JOB_STATUS char(20)
 3641          );
 NOTE: Table WORK.TBLREFGROUPS_ALL created, with 0 rows and 3 columns.
 3642       
 3643       insert into WORK.TBLREFGROUPS_ALL
 3644       
 3645       VALUES('AMI','AMI','DISPATCHED')
 3646       VALUES('AMI','AMI','NOT_DISPATCHED')
 3647       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 3648       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 3649       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 3650       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 3651       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 3652       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3653       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 3654       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 3655       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 3656       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 3657       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 3658       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3659       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 3660       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3661       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 3662       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3663       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 3664       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 3665       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 3666       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 3667       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 3668       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 3669       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 3670       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 3671       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 3672       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 3673       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 3674       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 3675       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 3676       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 3677       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 3678       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 3679       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 3680       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 3681       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 3682       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 3683       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 3684       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3685       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 3686       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 3687       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 3688       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 3689       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 3690       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 3691       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 3692       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 3693       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 3694       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 3695       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 3696       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 3697       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 3698       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 3699       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 3700       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 3701       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 3702       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 3703       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 3704       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 3705       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 3706       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3707       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 3708       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 3709       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 3710       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 3711       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 3712       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 3713       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 3714       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 3715       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 3716       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 3717       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 3718       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 3719       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 3720       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 3721       VALUES('MA37','SRO1','DISPATCHED')
 3722       VALUES('MA37','SRO1','NOT_DISPATCHED')
 3723       VALUES('MA38','SRO2','DISPATCHED')
 3724       VALUES('MA38','SRO2','NOT_DISPATCHED')
 3725       VALUES('MA39','SRO3','DISPATCHED')
 3726       VALUES('MA39','SRO3','NOT_DISPATCHED')
 3727       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 3728       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3729       VALUES('MA40','SRO4','DISPATCHED')
 3730       VALUES('MA40','SRO4','NOT_DISPATCHED')
 3731       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 3732       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3733       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 3734       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3735       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 3736       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3737       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 3738       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3739       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 3740       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3741       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 3742       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 3743       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 3744       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 3745       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 3746       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 3747       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 3748       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 3749       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 3750       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3751       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 3752       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 3753       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 3754       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 3755       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 3756       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3757       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 3758       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 3759       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 3760       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 3761       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 3762       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 3763       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 3764       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 3765       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 3766       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 3767       VALUES('RFS','REFER TO SPT','DISPATCHED')
 3768       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 3769       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 3770       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 3771       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 3772       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 3773       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 3774       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3775       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 3776       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3777       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 3778       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 3779       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 3780       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3781       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 3782       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 3783       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 3784       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_ALL.
 
 3785       
 3786       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 3787       
 3788       PROC SQL;
 3789       CREATE TABLE WORK.GETJOBSDISPBYREFER_ALL
 3790       AS
 3791       (
 3792       SELECT
 3793       MAIN.CODE
 3794       ,MAIN.JOB_STATUS
 3795       ,SUM(TTL_JOBS) AS TTL_JOBS
 3796       FROM
 3797       (
 3798       SELECT
 3799         MAIN.CODE
 3800         ,MAIN.JOB_STATUS
 3801         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 3802       FROM
 3803       (
 3804       SELECT
 3805       CODE
 3806       ,JOB_STATUS
 3807       FROM WORK.TBLREFGROUPS_ALL
 3808       ) MAIN
 3809       
 3810       LEFT OUTER JOIN
 3811       (
 3812           SELECT
 3813             CASE
 3814               WHEN REFERRED_TO IS NULL
 3815               THEN
 3816                 'OPS'
 3817               ELSE
 3818                 REFERRED_TO
 3819             END AS REFERRED_TO
 3820             ,'DISPATCHED' AS JOB_STATUS
 3821             ,CASE
 3822               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 3823                 THEN COUNT(REFERRED_TO)
 3824                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 3825             END AS TTL_JOBS
 3826       
 3827           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 3828           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 3828     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING)
 3829           GROUP BY REFERRED_TO, JOB_STATUS
 3830       
 3831           UNION
 3832       
 3833           SELECT
 3834             CASE
 3835               WHEN REFERRED_TO IS NULL
 3836               THEN
 3837                 'OPS'
 3838               ELSE
 3839                 REFERRED_TO
 3840             END AS REFERRED_TO
 3841             ,'NOT_DISPATCHED' AS JOB_STATUS
 3842             ,CASE
 3843               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 3844                 THEN COUNT(REFERRED_TO)
 3845                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 3846             END AS TTL_JOBS
 3847       
 3848           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 3849           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 3849     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING)
 3850           GROUP BY REFERRED_TO, JOB_STATUS
 3851       )SUB
 3852       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 3853       )
 3854       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 3855       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 3856       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_ALL created, with 136 rows and 3 columns.
 
 3857       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 3858       
 3859       PROC SQL;
 3860       CREATE VIEW WORK.SORTTempTableSorted_ALL AS
 3861       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 3862       FROM WORK.GETJOBSDISPBYREFER_ALL as T
 3863       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ALL has been defined.
 3864       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3865       
 3866       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ALL
 3867       OUT=WORK.TRNSTRANSPOSEDJOBS1_ALL(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 3868       NAME=Source
 3869       LABEL=Label
 3870       ;
 3871       BY CODE;
 3872       ID JOB_STATUS;
 3873       VAR TTL_JOBS;
 3874       
 3875       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_ALL.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_ALL.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_ALL has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3876       QUIT;
 3877       
 3878       PROC SQL;
 3879          CREATE TABLE WORK.qryGetJobsDispByRefNot0_ALL AS
 3880          SELECT t1.CODE AS REFERRED_TO,
 3881                 t1.DISPATCHED AS JOBS_DISPATCHED,
 3882                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 3883             FROM WORK.TRNSTRANSPOSEDJOBS1_ALL t1
 3884             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_ALL created, with 1 rows and 3 columns.
 
 3885       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 3886       
 3887       PROC SQL;
 3888       CREATE TABLE GETJOBSSURVEY2_ALL
 3889       AS
 3890       (
 3891       SELECT
 3892       MAIN.CODE
 3893       ,MAIN.JOB_STATUS
 3894       ,SUM(TTL_JOBS) AS TTL_JOBS
 3895       FROM
 3896       (
 3897       SELECT
 3898         MAIN.CODE
 3899         ,MAIN.JOB_STATUS
 3900         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 3901       FROM
 3902       (
 3903       SELECT
 3904       CODE
 3905       ,JOB_STATUS
 3906       FROM WORK.TBLREFGROUPS_ALL
 3907       ) MAIN
 3908       
 3909       LEFT OUTER JOIN
 3910       (
 3911           SELECT
 3912             CASE
 3913               WHEN REFERRED_TO IS NULL
 3914               THEN
 3915                 'OPS'
 3916               ELSE
 3917                 REFERRED_TO
 3918             END AS REFERRED_TO
 3919             ,'DISPATCHED' AS JOB_STATUS
 3920             ,CASE
 3921               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 3922                 THEN COUNT(REFERRED_TO)
 3923                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 3924             END AS TTL_JOBS
 3925       
 3926           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 3927           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 3927     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING)
 3928           GROUP BY REFERRED_TO, JOB_STATUS
 3929       
 3930           UNION
 3931       
 3932           SELECT
 3933             CASE
 3934               WHEN REFERRED_TO IS NULL
 3935               THEN
 3936                 'OPS'
 3937               ELSE
 3938                 REFERRED_TO
 3939             END AS REFERRED_TO
 3940             ,'NOT_DISPATCHED' AS JOB_STATUS
 3941             ,CASE
 3942               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 3943                 THEN COUNT(REFERRED_TO)
 3944                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 3945             END AS TTL_JOBS
 3946       
 3947           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 3948           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 3948     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING)
 3949           GROUP BY REFERRED_TO, JOB_STATUS
 3950       )SUB
 3951       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 3952       )
 3953       WHERE MAIN.CODE IN ('PRE', 'LKP')
 3954       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 3955       );
 NOTE: Table WORK.GETJOBSSURVEY2_ALL created, with 4 rows and 3 columns.
 
 3956       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 3957       
 3958       PROC SQL;
 3959       CREATE VIEW WORK.SORTTempTableSorted_ALL AS
 3960       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 3961       FROM WORK.GETJOBSSURVEY2_ALL as T
 3962       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ALL has been defined.
 3963       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3964       
 3965       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ALL
 3966       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_ALL(LABEL="Transposed WORK.GETJOBSSURVEY2")
 3967       NAME=Source
 3968       LABEL=Label
 3969       ;
 3970       BY CODE;
 3971       ID JOB_STATUS;
 3972       VAR TTL_JOBS;
 3973       
 3974       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_ALL.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_ALL.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_ALL has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3975       QUIT;
 3976       
 3977       PROC SQL;
 3978          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_ALL AS
 3979          SELECT t1.CODE AS REFERRED_TO,
 3980                 t1.DISPATCHED AS JOBS_DISPATCHED,
 3981                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 3982             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_ALL t1
 3983             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_ALL created, with 0 rows and 3 columns.
 
 3984       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 3985       
 3986       PROC SQL;
 3987       CREATE TABLE WORK.AppendJobsAndSurvey_ALL AS
 3988       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_ALL
 3989        OUTER UNION CORR
 3990       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_ALL
 3991       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_ALL created, with 1 rows and 3 columns.
 
 3992       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 3993       
 3994       PROC SQL;
 3995       CREATE TABLE WORK.GETCUSTSURVEY2_ALL
 3996       AS
 3997       (
 3998       SELECT
 3999       MAIN.CODE
 4000       ,MAIN.JOB_STATUS
 4001       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4002       FROM
 4003       (
 4004       SELECT
 4005         MAIN.CODE
 4006         ,MAIN.JOB_STATUS
 4007         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 4008       FROM
 4009       (
 4010       SELECT
 4011       CODE
 4012       ,JOB_STATUS
 4013       FROM WORK.TBLREFGROUPS_ALL
 4014       ) MAIN
 4015       
 4016       LEFT OUTER JOIN
 4017       (
 4018           SELECT
 4019             CASE
 4020               WHEN REFERRED_TO IS NULL
 4021               THEN
 4022                 'OPS'
 4023               ELSE
 4024                 REFERRED_TO
 4025             END AS REFERRED_TO
 4026             ,'DISPATCHED' AS JOB_STATUS
 4027             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4028       
 4029           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4030           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 4030     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING)
 4031           GROUP BY REFERRED_TO, JOB_STATUS
 4032       
 4033           UNION
 4034       
 4035           SELECT
 4036             CASE
 4037               WHEN REFERRED_TO IS NULL
 4038               THEN
 4039                 'OPS'
 4040               ELSE
 4041                 REFERRED_TO
 4042             END AS REFERRED_TO
 4043             ,'NOT_DISPATCHED' AS JOB_STATUS
 4044             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4045       
 4046           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4047           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 4047     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING)
 4048           GROUP BY REFERRED_TO, JOB_STATUS
 4049       )SUB
 4050       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 4051       )
 4052       WHERE MAIN.CODE IN ('PRE', 'LKP')
 4053       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 4054       );
 NOTE: Table WORK.GETCUSTSURVEY2_ALL created, with 4 rows and 3 columns.
 
 4055       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 4056       
 4057       PROC SQL;
 4058       CREATE VIEW WORK.SORTTempTableSorted_ALL AS
 4059       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 4060       FROM WORK.GETCUSTSURVEY2_ALL as T
 4061       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ALL has been defined.
 4062       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4063       
 4064       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ALL
 4065       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_ALL(LABEL="Transposed WORK.GETCUSTSURVEY2")
 4066       NAME=Source
 4067       LABEL=Label
 4068       ;
 4069       BY CODE;
 4070       ID JOB_STATUS;
 4071       VAR TTL_CUST_OUT;
 4072       
 4073       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_ALL.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_ALL.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_ALL has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4074       QUIT;
 4075       
 4076       PROC SQL;
 4077          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_ALL AS
 4078          SELECT t1.CODE AS REFERRED_TO,
 4079                 t1.DISPATCHED AS CUST_DISPATCHED,
 4080                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 4081             FROM WORK.TRNSTRANSPOSEDSURVCUST1_ALL t1
 4082             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_ALL created, with 0 rows and 3 columns.
 
 4083       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4084       
 4085       PROC SQL;
 4086       CREATE TABLE WORK.GETCUSTDISPBYREFER_ALL
 4087       AS
 4088       (
 4089       SELECT
 4090       MAIN.CODE
 4091       ,MAIN.JOB_STATUS
 4092       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4093       FROM
 4094       (
 4095       SELECT
 4096         MAIN.CODE
 4097         ,MAIN.JOB_STATUS
 4098         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 4099       FROM
 4100       (
 4101       SELECT
 4102       CODE
 4103       ,JOB_STATUS
 4104       FROM WORK.TBLREFGROUPS_ALL
 4105       ) MAIN
 4106       
 4107       LEFT OUTER JOIN
 4108       (
 4109           SELECT
 4110             CASE
 4111               WHEN REFERRED_TO IS NULL
 4112               THEN
 4113                 'OPS'
 4114               ELSE
 4115                 REFERRED_TO
 4116             END AS REFERRED_TO
 4117             ,'DISPATCHED' AS JOB_STATUS
 4118             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4119       
 4120           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4121           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 4121     ! MISSING)
 4122           GROUP BY REFERRED_TO, JOB_STATUS
 4123       
 4124           UNION
 4125       
 4126           SELECT
 4127             CASE
 4128               WHEN REFERRED_TO IS NULL
 4129               THEN
 4130                 'OPS'
 4131               ELSE
 4132                 REFERRED_TO
 4133             END AS REFERRED_TO
 4134             ,'NOT_DISPATCHED' AS JOB_STATUS
 4135             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4136       
 4137           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4138           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 4138     ! MISSING)
 4139           GROUP BY REFERRED_TO, JOB_STATUS
 4140       )SUB
 4141       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 4142       )
 4143       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 4144       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 4145       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_ALL created, with 136 rows and 3 columns.
 
 4146       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 4147       
 4148       PROC SQL;
 4149       CREATE VIEW WORK.SORTTempTableSorted_ALL AS
 4150       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 4151       FROM WORK.GETCUSTDISPBYREFER_ALL as T
 4152       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ALL has been defined.
 4153       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4154       
 4155       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ALL
 4156       OUT=WORK.TRNSTRANSPOSEDCUSTS1_ALL(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 4157       NAME=Source
 4158       LABEL=Label
 4159       ;
 4160       BY CODE;
 4161       ID JOB_STATUS;
 4162       VAR TTL_CUST_OUT;
 4163       
 4164       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_ALL.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_ALL.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_ALL has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4165       QUIT;
 4166       
 4167       PROC SQL;
 4168          CREATE TABLE WORK.qryGetCustDispByRefNot0_ALL AS
 4169          SELECT t1.CODE AS REFERRED_TO,
 4170                 t1.DISPATCHED AS CUST_DISPATCHED,
 4171                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 4172             FROM WORK.TRNSTRANSPOSEDCUSTS1_ALL t1
 4173             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_ALL created, with 1 rows and 3 columns.
 
 4174       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4175       
 4176       PROC SQL;
 4177       CREATE TABLE WORK.AppendCustAndSurvey_ALL AS
 4178       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_ALL
 4179        OUTER UNION CORR
 4180       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_ALL
 4181       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_ALL created, with 1 rows and 3 columns.
 
 4182       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4183       
 4184       PROC SQL;
 4185          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_ALL AS
 4186          SELECT
 4187            ('0 - PSEGLI ALL') AS DIVISION,
 4188            t4.REFERRED_TO,
 4189                 t1.CUST_DISPATCHED,
 4190                 t1.CUST_NOT_DISPATCHED,
 4191                 t4.JOBS_DISPATCHED,
 4192                 t4.JOBS_NOT_DISPATCHED,
 4193                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 4194                 t3.ALL_JOBS_OUT AS ALL_JOBS
 4195             FROM WORK.QRYALLJOBSCUSTBYREFGRP_ALL t3, WORK.APPENDJOBSANDSURVEY_ALL t4, WORK.APPENDCUSTANDSURVEY_ALL t1
 4196             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_ALL created, with 1 rows and 8 columns.
 
 4197       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4198       
 4199       /* ************************************************************** ALL
 4199     ! ************************************************************** */
 4200       
 4201       /* ************************************************************** QN
 4201     ! ************************************************************** */
 4202       
 4203       PROC SQL;
 4204          CREATE TABLE WORK.qryAllJobsCustByRefGrp_QN AS
 4205          SELECT /* REFERRED_TO */
 4206                   (CASE
 4207                     WHEN t1.REFERRED_TO IS NULL
 4208                       THEN 'OPS'
 4209                        ELSE t1.REFERRED_TO
 4210                   END) AS REFERRED_TO,
 4211                 /* ALL_CUST_OUT */
 4212                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 4213                 /* ALL_JOBS_OUT */
 4214                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 4215             FROM WORK.QRYSTORM_FMT_DATES t1
 4216             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 4216     ! t1.DISTRICT IN ('1 - Queens, Nas.')
 4217             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_QN created, with 1 rows and 3 columns.
 
 4218       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4219       
 4220       proc sql;
 4221          create table WORK.TBLREFGROUPS_QN
 4222          (
 4223       CODE char(12),
 4224               DESC char(50),
 4225               JOB_STATUS char(20)
 4226          );
 NOTE: Table WORK.TBLREFGROUPS_QN created, with 0 rows and 3 columns.
 4227       
 4228       insert into WORK.TBLREFGROUPS_QN
 4229       
 4230       VALUES('AMI','AMI','DISPATCHED')
 4231       VALUES('AMI','AMI','NOT_DISPATCHED')
 4232       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 4233       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 4234       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 4235       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 4236       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 4237       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4238       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 4239       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 4240       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 4241       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 4242       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 4243       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4244       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 4245       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4246       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 4247       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4248       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 4249       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 4250       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 4251       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 4252       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 4253       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 4254       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 4255       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 4256       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 4257       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 4258       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 4259       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 4260       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 4261       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 4262       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 4263       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 4264       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 4265       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 4266       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 4267       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 4268       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 4269       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4270       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 4271       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 4272       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 4273       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 4274       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 4275       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 4276       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 4277       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 4278       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 4279       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 4280       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 4281       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 4282       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 4283       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 4284       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 4285       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 4286       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 4287       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 4288       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 4289       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 4290       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 4291       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4292       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 4293       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 4294       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 4295       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 4296       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 4297       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 4298       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 4299       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 4300       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 4301       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 4302       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 4303       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 4304       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 4305       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 4306       VALUES('MA37','SRO1','DISPATCHED')
 4307       VALUES('MA37','SRO1','NOT_DISPATCHED')
 4308       VALUES('MA38','SRO2','DISPATCHED')
 4309       VALUES('MA38','SRO2','NOT_DISPATCHED')
 4310       VALUES('MA39','SRO3','DISPATCHED')
 4311       VALUES('MA39','SRO3','NOT_DISPATCHED')
 4312       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 4313       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4314       VALUES('MA40','SRO4','DISPATCHED')
 4315       VALUES('MA40','SRO4','NOT_DISPATCHED')
 4316       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 4317       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4318       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 4319       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4320       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 4321       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4322       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 4323       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4324       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 4325       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4326       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 4327       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 4328       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 4329       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 4330       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 4331       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 4332       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 4333       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 4334       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 4335       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4336       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 4337       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 4338       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 4339       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 4340       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 4341       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4342       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 4343       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 4344       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 4345       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 4346       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 4347       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 4348       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 4349       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 4350       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 4351       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 4352       VALUES('RFS','REFER TO SPT','DISPATCHED')
 4353       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 4354       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 4355       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 4356       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 4357       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 4358       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 4359       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4360       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 4361       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4362       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 4363       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 4364       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 4365       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4366       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 4367       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4368       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 4369       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_QN.
 
 4370       
 4371       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4372       
 4373       PROC SQL;
 4374       CREATE TABLE WORK.GETJOBSDISPBYREFER_QN
 4375       AS
 4376       (
 4377       SELECT
 4378       MAIN.CODE
 4379       ,MAIN.JOB_STATUS
 4380       ,SUM(TTL_JOBS) AS TTL_JOBS
 4381       FROM
 4382       (
 4383       SELECT
 4384         MAIN.CODE
 4385         ,MAIN.JOB_STATUS
 4386         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 4387       FROM
 4388       (
 4389       SELECT
 4390       CODE
 4391       ,JOB_STATUS
 4392       FROM WORK.TBLREFGROUPS_QN
 4393       ) MAIN
 4394       
 4395       LEFT OUTER JOIN
 4396       (
 4397           SELECT
 4398             CASE
 4399               WHEN REFERRED_TO IS NULL
 4400               THEN
 4401                 'OPS'
 4402               ELSE
 4403                 REFERRED_TO
 4404             END AS REFERRED_TO
 4405             ,'DISPATCHED' AS JOB_STATUS
 4406             ,CASE
 4407               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 4408                 THEN COUNT(REFERRED_TO)
 4409                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 4410             END AS TTL_JOBS
 4411       
 4412           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4413           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 4413     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.')
 4414           GROUP BY REFERRED_TO, JOB_STATUS
 4415       
 4416           UNION
 4417       
 4418           SELECT
 4419             CASE
 4420               WHEN REFERRED_TO IS NULL
 4421               THEN
 4422                 'OPS'
 4423               ELSE
 4424                 REFERRED_TO
 4425             END AS REFERRED_TO
 4426             ,'NOT_DISPATCHED' AS JOB_STATUS
 4427             ,CASE
 4428               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 4429                 THEN COUNT(REFERRED_TO)
 4430                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 4431             END AS TTL_JOBS
 4432       
 4433           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4434           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 4434     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.')
 4435           GROUP BY REFERRED_TO, JOB_STATUS
 4436       )SUB
 4437       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 4438       )
 4439       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 4440       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 4441       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_QN created, with 136 rows and 3 columns.
 
 4442       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 4443       
 4444       PROC SQL;
 4445       CREATE VIEW WORK.SORTTempTableSorted_QN AS
 4446       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 4447       FROM WORK.GETJOBSDISPBYREFER_QN as T
 4448       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_QN has been defined.
 4449       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4450       
 4451       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_QN
 4452       OUT=WORK.TRNSTRANSPOSEDJOBS1_QN(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 4453       NAME=Source
 4454       LABEL=Label
 4455       ;
 4456       BY CODE;
 4457       ID JOB_STATUS;
 4458       VAR TTL_JOBS;
 4459       
 4460       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_QN.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_QN.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_QN has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4461       QUIT;
 4462       
 4463       PROC SQL;
 4464          CREATE TABLE WORK.qryGetJobsDispByRefNot0_QN AS
 4465          SELECT t1.CODE AS REFERRED_TO,
 4466                 t1.DISPATCHED AS JOBS_DISPATCHED,
 4467                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 4468             FROM WORK.TRNSTRANSPOSEDJOBS1_QN t1
 4469             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_QN created, with 1 rows and 3 columns.
 
 4470       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4471       
 4472       PROC SQL;
 4473       CREATE TABLE GETJOBSSURVEY2_QN
 4474       AS
 4475       (
 4476       SELECT
 4477       MAIN.CODE
 4478       ,MAIN.JOB_STATUS
 4479       ,SUM(TTL_JOBS) AS TTL_JOBS
 4480       FROM
 4481       (
 4482       SELECT
 4483         MAIN.CODE
 4484         ,MAIN.JOB_STATUS
 4485         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 4486       FROM
 4487       (
 4488       SELECT
 4489       CODE
 4490       ,JOB_STATUS
 4491       FROM WORK.TBLREFGROUPS_QN
 4492       ) MAIN
 4493       
 4494       LEFT OUTER JOIN
 4495       (
 4496           SELECT
 4497             CASE
 4498               WHEN REFERRED_TO IS NULL
 4499               THEN
 4500                 'OPS'
 4501               ELSE
 4502                 REFERRED_TO
 4503             END AS REFERRED_TO
 4504             ,'DISPATCHED' AS JOB_STATUS
 4505             ,CASE
 4506               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 4507                 THEN COUNT(REFERRED_TO)
 4508                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 4509             END AS TTL_JOBS
 4510       
 4511           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4512           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 4512     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1
 4512     ! - Queens, Nas.')
 4513           GROUP BY REFERRED_TO, JOB_STATUS
 4514       
 4515           UNION
 4516       
 4517           SELECT
 4518             CASE
 4519               WHEN REFERRED_TO IS NULL
 4520               THEN
 4521                 'OPS'
 4522               ELSE
 4523                 REFERRED_TO
 4524             END AS REFERRED_TO
 4525             ,'NOT_DISPATCHED' AS JOB_STATUS
 4526             ,CASE
 4527               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 4528                 THEN COUNT(REFERRED_TO)
 4529                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 4530             END AS TTL_JOBS
 4531       
 4532           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4533           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 4533     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.')
 4534           GROUP BY REFERRED_TO, JOB_STATUS
 4535       )SUB
 4536       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 4537       )
 4538       WHERE MAIN.CODE IN ('PRE', 'LKP')
 4539       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 4540       );
 NOTE: Table WORK.GETJOBSSURVEY2_QN created, with 4 rows and 3 columns.
 
 4541       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 4542       
 4543       PROC SQL;
 4544       CREATE VIEW WORK.SORTTempTableSorted_QN AS
 4545       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 4546       FROM WORK.GETJOBSSURVEY2_QN as T
 4547       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_QN has been defined.
 4548       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4549       
 4550       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_QN
 4551       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_QN(LABEL="Transposed WORK.GETJOBSSURVEY2")
 4552       NAME=Source
 4553       LABEL=Label
 4554       ;
 4555       BY CODE;
 4556       ID JOB_STATUS;
 4557       VAR TTL_JOBS;
 4558       
 4559       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_QN.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_QN.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_QN has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4560       QUIT;
 4561       
 4562       PROC SQL;
 4563          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_QN AS
 4564          SELECT t1.CODE AS REFERRED_TO,
 4565                 t1.DISPATCHED AS JOBS_DISPATCHED,
 4566                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 4567             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_QN t1
 4568             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_QN created, with 0 rows and 3 columns.
 
 4569       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4570       
 4571       PROC SQL;
 4572       CREATE TABLE WORK.AppendJobsAndSurvey_QN AS
 4573       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_QN
 4574        OUTER UNION CORR
 4575       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_QN
 4576       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_QN created, with 1 rows and 3 columns.
 
 4577       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4578       
 4579       PROC SQL;
 4580       CREATE TABLE WORK.GETCUSTSURVEY2_QN
 4581       AS
 4582       (
 4583       SELECT
 4584       MAIN.CODE
 4585       ,MAIN.JOB_STATUS
 4586       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4587       FROM
 4588       (
 4589       SELECT
 4590         MAIN.CODE
 4591         ,MAIN.JOB_STATUS
 4592         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 4593       FROM
 4594       (
 4595       SELECT
 4596       CODE
 4597       ,JOB_STATUS
 4598       FROM WORK.TBLREFGROUPS_QN
 4599       ) MAIN
 4600       
 4601       LEFT OUTER JOIN
 4602       (
 4603           SELECT
 4604             CASE
 4605               WHEN REFERRED_TO IS NULL
 4606               THEN
 4607                 'OPS'
 4608               ELSE
 4609                 REFERRED_TO
 4610             END AS REFERRED_TO
 4611             ,'DISPATCHED' AS JOB_STATUS
 4612             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4613       
 4614           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4615           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 4615     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1
 4615     ! - Queens, Nas.')
 4616           GROUP BY REFERRED_TO, JOB_STATUS
 4617       
 4618           UNION
 4619       
 4620           SELECT
 4621             CASE
 4622               WHEN REFERRED_TO IS NULL
 4623               THEN
 4624                 'OPS'
 4625               ELSE
 4626                 REFERRED_TO
 4627             END AS REFERRED_TO
 4628             ,'NOT_DISPATCHED' AS JOB_STATUS
 4629             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4630       
 4631           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4632           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 4632     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.')
 4633           GROUP BY REFERRED_TO, JOB_STATUS
 4634       )SUB
 4635       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 4636       )
 4637       WHERE MAIN.CODE IN ('PRE', 'LKP')
 4638       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 4639       );
 NOTE: Table WORK.GETCUSTSURVEY2_QN created, with 4 rows and 3 columns.
 
 4640       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 4641       
 4642       PROC SQL;
 4643       CREATE VIEW WORK.SORTTempTableSorted_QN AS
 4644       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 4645       FROM WORK.GETCUSTSURVEY2_QN as T
 4646       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_QN has been defined.
 4647       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4648       
 4649       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_QN
 4650       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_QN(LABEL="Transposed WORK.GETCUSTSURVEY2")
 4651       NAME=Source
 4652       LABEL=Label
 4653       ;
 4654       BY CODE;
 4655       ID JOB_STATUS;
 4656       VAR TTL_CUST_OUT;
 4657       
 4658       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_QN.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_QN.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_QN has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4659       QUIT;
 4660       
 4661       PROC SQL;
 4662          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_QN AS
 4663          SELECT t1.CODE AS REFERRED_TO,
 4664                 t1.DISPATCHED AS CUST_DISPATCHED,
 4665                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 4666             FROM WORK.TRNSTRANSPOSEDSURVCUST1_QN t1
 4667             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_QN created, with 0 rows and 3 columns.
 
 4668       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4669       
 4670       PROC SQL;
 4671       CREATE TABLE WORK.GETCUSTDISPBYREFER_QN
 4672       AS
 4673       (
 4674       SELECT
 4675       MAIN.CODE
 4676       ,MAIN.JOB_STATUS
 4677       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4678       FROM
 4679       (
 4680       SELECT
 4681         MAIN.CODE
 4682         ,MAIN.JOB_STATUS
 4683         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 4684       FROM
 4685       (
 4686       SELECT
 4687       CODE
 4688       ,JOB_STATUS
 4689       FROM WORK.TBLREFGROUPS_QN
 4690       ) MAIN
 4691       
 4692       LEFT OUTER JOIN
 4693       (
 4694           SELECT
 4695             CASE
 4696               WHEN REFERRED_TO IS NULL
 4697               THEN
 4698                 'OPS'
 4699               ELSE
 4700                 REFERRED_TO
 4701             END AS REFERRED_TO
 4702             ,'DISPATCHED' AS JOB_STATUS
 4703             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4704       
 4705           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4706           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 4706     ! MISSING) AND DISTRICT IN ('1 - Queens, Nas.')
 4707           GROUP BY REFERRED_TO, JOB_STATUS
 4708       
 4709           UNION
 4710       
 4711           SELECT
 4712             CASE
 4713               WHEN REFERRED_TO IS NULL
 4714               THEN
 4715                 'OPS'
 4716               ELSE
 4717                 REFERRED_TO
 4718             END AS REFERRED_TO
 4719             ,'NOT_DISPATCHED' AS JOB_STATUS
 4720             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 4721       
 4722           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4723           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 4723     ! MISSING) AND DISTRICT IN ('1 - Queens, Nas.')
 4724           GROUP BY REFERRED_TO, JOB_STATUS
 4725       )SUB
 4726       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 4727       )
 4728       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 4729       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 4730       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_QN created, with 136 rows and 3 columns.
 
 4731       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 4732       
 4733       PROC SQL;
 4734       CREATE VIEW WORK.SORTTempTableSorted_QN AS
 4735       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 4736       FROM WORK.GETCUSTDISPBYREFER_QN as T
 4737       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_QN has been defined.
 4738       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4739       
 4740       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_QN
 4741       OUT=WORK.TRNSTRANSPOSEDCUSTS1_QN(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 4742       NAME=Source
 4743       LABEL=Label
 4744       ;
 4745       BY CODE;
 4746       ID JOB_STATUS;
 4747       VAR TTL_CUST_OUT;
 4748       
 4749       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_QN.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_QN.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_QN has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4750       QUIT;
 4751       
 4752       PROC SQL;
 4753          CREATE TABLE WORK.qryGetCustDispByRefNot0_QN AS
 4754          SELECT t1.CODE AS REFERRED_TO,
 4755                 t1.DISPATCHED AS CUST_DISPATCHED,
 4756                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 4757             FROM WORK.TRNSTRANSPOSEDCUSTS1_QN t1
 4758             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_QN created, with 1 rows and 3 columns.
 
 4759       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4760       
 4761       PROC SQL;
 4762       CREATE TABLE WORK.AppendCustAndSurvey_QN AS
 4763       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_QN
 4764        OUTER UNION CORR
 4765       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_QN
 4766       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_QN created, with 1 rows and 3 columns.
 
 4767       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4768       
 4769       PROC SQL;
 4770          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_QN AS
 4771          SELECT
 4772            ('1 - Queens, Nas.') AS DIVISION,
 4773            t4.REFERRED_TO,
 4774                 t1.CUST_DISPATCHED,
 4775                 t1.CUST_NOT_DISPATCHED,
 4776                 t4.JOBS_DISPATCHED,
 4777                 t4.JOBS_NOT_DISPATCHED,
 4778                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 4779                 t3.ALL_JOBS_OUT AS ALL_JOBS
 4780             FROM WORK.QRYALLJOBSCUSTBYREFGRP_QN t3, WORK.APPENDJOBSANDSURVEY_QN t4, WORK.APPENDCUSTANDSURVEY_QN t1
 4781             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_QN created, with 1 rows and 8 columns.
 
 4782       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4783       
 4784       /* ************************************************************** QN
 4784     ! ************************************************************** */
 4785       
 4786       /* ************************************************************** CN
 4786     ! ************************************************************** */
 4787       
 4788       PROC SQL;
 4789          CREATE TABLE WORK.qryAllJobsCustByRefGrp_CN AS
 4790          SELECT /* REFERRED_TO */
 4791                   (CASE
 4792                     WHEN t1.REFERRED_TO IS NULL
 4793                       THEN 'OPS'
 4794                        ELSE t1.REFERRED_TO
 4795                   END) AS REFERRED_TO,
 4796                 /* ALL_CUST_OUT */
 4797                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 4798                 /* ALL_JOBS_OUT */
 4799                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 4800             FROM WORK.QRYSTORM_FMT_DATES t1
 4801             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 4801     ! t1.DISTRICT IN ('2 - Central, Nas.')
 4802             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_CN created, with 1 rows and 3 columns.
 
 4803       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 4804       
 4805       proc sql;
 4806          create table WORK.TBLREFGROUPS_CN
 4807          (
 4808       CODE char(12),
 4809               DESC char(50),
 4810               JOB_STATUS char(20)
 4811          );
 NOTE: Table WORK.TBLREFGROUPS_CN created, with 0 rows and 3 columns.
 4812       
 4813       insert into WORK.TBLREFGROUPS_CN
 4814       
 4815       VALUES('AMI','AMI','DISPATCHED')
 4816       VALUES('AMI','AMI','NOT_DISPATCHED')
 4817       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 4818       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 4819       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 4820       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 4821       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 4822       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4823       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 4824       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 4825       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 4826       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 4827       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 4828       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4829       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 4830       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4831       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 4832       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4833       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 4834       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 4835       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 4836       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 4837       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 4838       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 4839       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 4840       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 4841       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 4842       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 4843       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 4844       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 4845       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 4846       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 4847       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 4848       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 4849       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 4850       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 4851       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 4852       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 4853       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 4854       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4855       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 4856       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 4857       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 4858       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 4859       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 4860       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 4861       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 4862       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 4863       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 4864       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 4865       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 4866       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 4867       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 4868       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 4869       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 4870       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 4871       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 4872       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 4873       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 4874       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 4875       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 4876       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4877       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 4878       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 4879       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 4880       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 4881       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 4882       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 4883       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 4884       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 4885       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 4886       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 4887       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 4888       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 4889       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 4890       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 4891       VALUES('MA37','SRO1','DISPATCHED')
 4892       VALUES('MA37','SRO1','NOT_DISPATCHED')
 4893       VALUES('MA38','SRO2','DISPATCHED')
 4894       VALUES('MA38','SRO2','NOT_DISPATCHED')
 4895       VALUES('MA39','SRO3','DISPATCHED')
 4896       VALUES('MA39','SRO3','NOT_DISPATCHED')
 4897       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 4898       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4899       VALUES('MA40','SRO4','DISPATCHED')
 4900       VALUES('MA40','SRO4','NOT_DISPATCHED')
 4901       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 4902       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4903       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 4904       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4905       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 4906       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4907       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 4908       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4909       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 4910       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4911       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 4912       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 4913       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 4914       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 4915       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 4916       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 4917       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 4918       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 4919       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 4920       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4921       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 4922       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 4923       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 4924       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 4925       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 4926       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4927       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 4928       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 4929       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 4930       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 4931       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 4932       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 4933       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 4934       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 4935       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 4936       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 4937       VALUES('RFS','REFER TO SPT','DISPATCHED')
 4938       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 4939       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 4940       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 4941       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 4942       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 4943       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 4944       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4945       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 4946       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4947       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 4948       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 4949       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 4950       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4951       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 4952       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 4953       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 4954       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_CN.
 
 4955       
 4956       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 4957       
 4958       PROC SQL;
 4959       CREATE TABLE WORK.GETJOBSDISPBYREFER_CN
 4960       AS
 4961       (
 4962       SELECT
 4963       MAIN.CODE
 4964       ,MAIN.JOB_STATUS
 4965       ,SUM(TTL_JOBS) AS TTL_JOBS
 4966       FROM
 4967       (
 4968       SELECT
 4969         MAIN.CODE
 4970         ,MAIN.JOB_STATUS
 4971         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 4972       FROM
 4973       (
 4974       SELECT
 4975       CODE
 4976       ,JOB_STATUS
 4977       FROM WORK.TBLREFGROUPS_CN
 4978       ) MAIN
 4979       
 4980       LEFT OUTER JOIN
 4981       (
 4982           SELECT
 4983             CASE
 4984               WHEN REFERRED_TO IS NULL
 4985               THEN
 4986                 'OPS'
 4987               ELSE
 4988                 REFERRED_TO
 4989             END AS REFERRED_TO
 4990             ,'DISPATCHED' AS JOB_STATUS
 4991             ,CASE
 4992               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 4993                 THEN COUNT(REFERRED_TO)
 4994                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 4995             END AS TTL_JOBS
 4996       
 4997           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 4998           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 4998     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('2 - Central, Nas.')
 4999           GROUP BY REFERRED_TO, JOB_STATUS
 5000       
 5001           UNION
 5002       
 5003           SELECT
 5004             CASE
 5005               WHEN REFERRED_TO IS NULL
 5006               THEN
 5007                 'OPS'
 5008               ELSE
 5009                 REFERRED_TO
 5010             END AS REFERRED_TO
 5011             ,'NOT_DISPATCHED' AS JOB_STATUS
 5012             ,CASE
 5013               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5014                 THEN COUNT(REFERRED_TO)
 5015                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5016             END AS TTL_JOBS
 5017       
 5018           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5019           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 5019     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('2 - Central, Nas.')
 5020           GROUP BY REFERRED_TO, JOB_STATUS
 5021       )SUB
 5022       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5023       )
 5024       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 5025       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 5026       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_CN created, with 136 rows and 3 columns.
 
 5027       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 5028       
 5029       PROC SQL;
 5030       CREATE VIEW WORK.SORTTempTableSorted_CN AS
 5031       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 5032       FROM WORK.GETJOBSDISPBYREFER_CN as T
 5033       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_CN has been defined.
 5034       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5035       
 5036       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_CN
 5037       OUT=WORK.TRNSTRANSPOSEDJOBS1_CN(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 5038       NAME=Source
 5039       LABEL=Label
 5040       ;
 5041       BY CODE;
 5042       ID JOB_STATUS;
 5043       VAR TTL_JOBS;
 5044       
 5045       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_CN.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_CN.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_CN has 68 observations and 4 variables.

 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5046       QUIT;
 5047       
 5048       PROC SQL;
 5049          CREATE TABLE WORK.qryGetJobsDispByRefNot0_CN AS
 5050          SELECT t1.CODE AS REFERRED_TO,
 5051                 t1.DISPATCHED AS JOBS_DISPATCHED,
 5052                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 5053             FROM WORK.TRNSTRANSPOSEDJOBS1_CN t1
 5054             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_CN created, with 1 rows and 3 columns.
 
 5055       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5056       
 5057       PROC SQL;
 5058       CREATE TABLE GETJOBSSURVEY2_CN
 5059       AS
 5060       (
 5061       SELECT
 5062       MAIN.CODE
 5063       ,MAIN.JOB_STATUS
 5064       ,SUM(TTL_JOBS) AS TTL_JOBS
 5065       FROM
 5066       (
 5067       SELECT
 5068         MAIN.CODE
 5069         ,MAIN.JOB_STATUS
 5070         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 5071       FROM
 5072       (
 5073       SELECT
 5074       CODE
 5075       ,JOB_STATUS
 5076       FROM WORK.TBLREFGROUPS_CN
 5077       ) MAIN
 5078       
 5079       LEFT OUTER JOIN
 5080       (
 5081           SELECT
 5082             CASE
 5083               WHEN REFERRED_TO IS NULL
 5084               THEN
 5085                 'OPS'
 5086               ELSE
 5087                 REFERRED_TO
 5088             END AS REFERRED_TO
 5089             ,'DISPATCHED' AS JOB_STATUS
 5090             ,CASE
 5091               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5092                 THEN COUNT(REFERRED_TO)
 5093                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5094             END AS TTL_JOBS
 5095       
 5096           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5097           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 5097     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('2
 5097     ! - Central, Nas.')
 5098           GROUP BY REFERRED_TO, JOB_STATUS
 5099       
 5100           UNION
 5101       
 5102           SELECT
 5103             CASE
 5104               WHEN REFERRED_TO IS NULL
 5105               THEN
 5106                 'OPS'
 5107               ELSE
 5108                 REFERRED_TO
 5109             END AS REFERRED_TO
 5110             ,'NOT_DISPATCHED' AS JOB_STATUS
 5111             ,CASE
 5112               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5113                 THEN COUNT(REFERRED_TO)
 5114                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5115             END AS TTL_JOBS
 5116       
 5117           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5118           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 5118     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('2 - Central, Nas.')
 5119           GROUP BY REFERRED_TO, JOB_STATUS
 5120       )SUB
 5121       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5122       )
 5123       WHERE MAIN.CODE IN ('PRE', 'LKP')
 5124       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 5125       );
 NOTE: Table WORK.GETJOBSSURVEY2_CN created, with 4 rows and 3 columns.
 
 5126       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 5127       
 5128       PROC SQL;
 5129       CREATE VIEW WORK.SORTTempTableSorted_CN AS
 5130       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 5131       FROM WORK.GETJOBSSURVEY2_CN as T
 5132       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_CN has been defined.
 5133       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5134       
 5135       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_CN
 5136       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_CN(LABEL="Transposed WORK.GETJOBSSURVEY2")
 5137       NAME=Source
 5138       LABEL=Label
 5139       ;
 5140       BY CODE;
 5141       ID JOB_STATUS;
 5142       VAR TTL_JOBS;
 5143       
 5144       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_CN.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_CN.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_CN has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5145       QUIT;
 5146       
 5147       PROC SQL;
 5148          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_CN AS
 5149          SELECT t1.CODE AS REFERRED_TO,
 5150                 t1.DISPATCHED AS JOBS_DISPATCHED,
 5151                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 5152             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_CN t1
 5153             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_CN created, with 0 rows and 3 columns.
 
 5154       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5155       
 5156       PROC SQL;
 5157       CREATE TABLE WORK.AppendJobsAndSurvey_CN AS
 5158       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_CN
 5159        OUTER UNION CORR
 5160       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_CN
 5161       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_CN created, with 1 rows and 3 columns.
 
 5162       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5163       
 5164       PROC SQL;
 5165       CREATE TABLE WORK.GETCUSTSURVEY2_CN
 5166       AS
 5167       (
 5168       SELECT
 5169       MAIN.CODE
 5170       ,MAIN.JOB_STATUS
 5171       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5172       FROM
 5173       (
 5174       SELECT
 5175         MAIN.CODE
 5176         ,MAIN.JOB_STATUS
 5177         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 5178       FROM
 5179       (
 5180       SELECT
 5181       CODE
 5182       ,JOB_STATUS
 5183       FROM WORK.TBLREFGROUPS_CN
 5184       ) MAIN
 5185       
 5186       LEFT OUTER JOIN
 5187       (
 5188           SELECT
 5189             CASE
 5190               WHEN REFERRED_TO IS NULL
 5191               THEN
 5192                 'OPS'
 5193               ELSE
 5194                 REFERRED_TO
 5195             END AS REFERRED_TO
 5196             ,'DISPATCHED' AS JOB_STATUS
 5197             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5198       
 5199           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5200           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 5200     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('2
 5200     ! - Central, Nas.')
 5201           GROUP BY REFERRED_TO, JOB_STATUS
 5202       
 5203           UNION
 5204       
 5205           SELECT
 5206             CASE
 5207               WHEN REFERRED_TO IS NULL
 5208               THEN
 5209                 'OPS'
 5210               ELSE
 5211                 REFERRED_TO
 5212             END AS REFERRED_TO
 5213             ,'NOT_DISPATCHED' AS JOB_STATUS
 5214             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5215       
 5216           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5217           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 5217     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('2 - Central, Nas.')
 5218           GROUP BY REFERRED_TO, JOB_STATUS
 5219       )SUB
 5220       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5221       )
 5222       WHERE MAIN.CODE IN ('PRE', 'LKP')
 5223       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 5224       );
 NOTE: Table WORK.GETCUSTSURVEY2_CN created, with 4 rows and 3 columns.
 
 5225       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 5226       
 5227       PROC SQL;
 5228       CREATE VIEW WORK.SORTTempTableSorted_CN AS
 5229       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 5230       FROM WORK.GETCUSTSURVEY2_CN as T
 5231       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_CN has been defined.
 5232       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5233       
 5234       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_CN
 5235       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_CN(LABEL="Transposed WORK.GETCUSTSURVEY2")
 5236       NAME=Source
 5237       LABEL=Label
 5238       ;
 5239       BY CODE;
 5240       ID JOB_STATUS;
 5241       VAR TTL_CUST_OUT;
 5242       
 5243       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_CN.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_CN.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_CN has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5244       QUIT;
 5245       
 5246       PROC SQL;
 5247          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_CN AS
 5248          SELECT t1.CODE AS REFERRED_TO,
 5249                 t1.DISPATCHED AS CUST_DISPATCHED,
 5250                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 5251             FROM WORK.TRNSTRANSPOSEDSURVCUST1_CN t1
 5252             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_CN created, with 0 rows and 3 columns.
 
 5253       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5254       
 5255       PROC SQL;
 5256       CREATE TABLE WORK.GETCUSTDISPBYREFER_CN
 5257       AS
 5258       (
 5259       SELECT
 5260       MAIN.CODE
 5261       ,MAIN.JOB_STATUS
 5262       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5263       FROM
 5264       (
 5265       SELECT
 5266         MAIN.CODE
 5267         ,MAIN.JOB_STATUS
 5268         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 5269       FROM
 5270       (
 5271       SELECT
 5272       CODE
 5273       ,JOB_STATUS
 5274       FROM WORK.TBLREFGROUPS_CN
 5275       ) MAIN
 5276       
 5277       LEFT OUTER JOIN
 5278       (
 5279           SELECT
 5280             CASE
 5281               WHEN REFERRED_TO IS NULL
 5282               THEN
 5283                 'OPS'
 5284               ELSE
 5285                 REFERRED_TO
 5286             END AS REFERRED_TO
 5287             ,'DISPATCHED' AS JOB_STATUS
 5288             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5289       
 5290           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5291           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 5291     ! MISSING) AND DISTRICT IN ('2 - Central, Nas.')
 5292           GROUP BY REFERRED_TO, JOB_STATUS
 5293       
 5294           UNION
 5295       
 5296           SELECT
 5297             CASE
 5298               WHEN REFERRED_TO IS NULL
 5299               THEN
 5300                 'OPS'
 5301               ELSE
 5302                 REFERRED_TO
 5303             END AS REFERRED_TO
 5304             ,'NOT_DISPATCHED' AS JOB_STATUS
 5305             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5306       
 5307           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5308           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 5308     ! MISSING) AND DISTRICT IN ('2 - Central, Nas.')
 5309           GROUP BY REFERRED_TO, JOB_STATUS
 5310       )SUB
 5311       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5312       )
 5313       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 5314       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 5315       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_CN created, with 136 rows and 3 columns.
 
 5316       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 5317       
 5318       PROC SQL;
 5319       CREATE VIEW WORK.SORTTempTableSorted_CN AS
 5320       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 5321       FROM WORK.GETCUSTDISPBYREFER_CN as T
 5322       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_CN has been defined.
 5323       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5324       
 5325       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_CN
 5326       OUT=WORK.TRNSTRANSPOSEDCUSTS1_CN(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 5327       NAME=Source
 5328       LABEL=Label
 5329       ;
 5330       BY CODE;
 5331       ID JOB_STATUS;
 5332       VAR TTL_CUST_OUT;
 5333       
 5334       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_CN.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_CN.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_CN has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5335       QUIT;
 5336       
 5337       PROC SQL;
 5338          CREATE TABLE WORK.qryGetCustDispByRefNot0_CN AS
 5339          SELECT t1.CODE AS REFERRED_TO,
 5340                 t1.DISPATCHED AS CUST_DISPATCHED,
 5341                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 5342             FROM WORK.TRNSTRANSPOSEDCUSTS1_CN t1
 5343             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_CN created, with 1 rows and 3 columns.
 
 5344       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5345       
 5346       PROC SQL;
 5347       CREATE TABLE WORK.AppendCustAndSurvey_CN AS
 5348       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_CN
 5349        OUTER UNION CORR
 5350       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_CN
 5351       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_CN created, with 1 rows and 3 columns.
 
 5352       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5353       
 5354       PROC SQL;
 5355          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_CN AS
 5356          SELECT
 5357            ('2 - Central, Nas.') AS DIVISION,
 5358            t4.REFERRED_TO,
 5359                 t1.CUST_DISPATCHED,
 5360                 t1.CUST_NOT_DISPATCHED,
 5361                 t4.JOBS_DISPATCHED,
 5362                 t4.JOBS_NOT_DISPATCHED,
 5363                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 5364                 t3.ALL_JOBS_OUT AS ALL_JOBS
 5365             FROM WORK.QRYALLJOBSCUSTBYREFGRP_CN t3, WORK.APPENDJOBSANDSURVEY_CN t4, WORK.APPENDCUSTANDSURVEY_CN t1
 5366             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_CN created, with 1 rows and 8 columns.
 
 5367       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 5368       
 5369       /* ************************************************************** CN
 5369     ! ************************************************************** */
 5370       
 5371       /* ************************************************************** WS
 5371     ! ************************************************************** */
 5372       
 5373       PROC SQL;
 5374          CREATE TABLE WORK.qryAllJobsCustByRefGrp_WS AS
 5375          SELECT /* REFERRED_TO */
 5376                   (CASE
 5377                     WHEN t1.REFERRED_TO IS NULL
 5378                       THEN 'OPS'
 5379                        ELSE t1.REFERRED_TO
 5380                   END) AS REFERRED_TO,
 5381                 /* ALL_CUST_OUT */
 5382                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 5383                 /* ALL_JOBS_OUT */
 5384                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 5385             FROM WORK.QRYSTORM_FMT_DATES t1
 5386             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 5386     ! t1.DISTRICT IN ('3 - Western, Suf.')
 5387             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_WS created, with 1 rows and 3 columns.
 
 5388       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5389       
 5390       proc sql;
 5391          create table WORK.TBLREFGROUPS_WS
 5392          (
 5393       CODE char(12),
 5394               DESC char(50),
 5395               JOB_STATUS char(20)
 5396          );
 NOTE: Table WORK.TBLREFGROUPS_WS created, with 0 rows and 3 columns.
 5397       
 5398       insert into WORK.TBLREFGROUPS_WS
 5399       
 5400       VALUES('AMI','AMI','DISPATCHED')
 5401       VALUES('AMI','AMI','NOT_DISPATCHED')
 5402       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 5403       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 5404       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 5405       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 5406       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 5407       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5408       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 5409       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 5410       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 5411       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 5412       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 5413       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5414       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 5415       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5416       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 5417       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5418       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 5419       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 5420       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 5421       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 5422       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 5423       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 5424       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 5425       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 5426       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 5427       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 5428       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 5429       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 5430       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 5431       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 5432       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 5433       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 5434       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 5435       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 5436       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 5437       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 5438       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 5439       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5440       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 5441       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 5442       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 5443       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 5444       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 5445       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 5446       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 5447       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 5448       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 5449       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 5450       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 5451       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 5452       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 5453       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 5454       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 5455       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 5456       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 5457       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 5458       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 5459       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 5460       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 5461       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5462       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 5463       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 5464       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 5465       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 5466       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 5467       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 5468       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 5469       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 5470       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 5471       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 5472       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 5473       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 5474       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 5475       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 5476       VALUES('MA37','SRO1','DISPATCHED')
 5477       VALUES('MA37','SRO1','NOT_DISPATCHED')
 5478       VALUES('MA38','SRO2','DISPATCHED')
 5479       VALUES('MA38','SRO2','NOT_DISPATCHED')
 5480       VALUES('MA39','SRO3','DISPATCHED')
 5481       VALUES('MA39','SRO3','NOT_DISPATCHED')
 5482       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 5483       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5484       VALUES('MA40','SRO4','DISPATCHED')
 5485       VALUES('MA40','SRO4','NOT_DISPATCHED')
 5486       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 5487       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5488       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 5489       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5490       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 5491       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5492       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 5493       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5494       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 5495       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5496       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 5497       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 5498       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 5499       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 5500       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 5501       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 5502       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 5503       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 5504       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 5505       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5506       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 5507       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 5508       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 5509       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 5510       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 5511       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5512       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 5513       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 5514       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 5515       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 5516       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 5517       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 5518       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 5519       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 5520       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 5521       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 5522       VALUES('RFS','REFER TO SPT','DISPATCHED')
 5523       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 5524       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 5525       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 5526       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 5527       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 5528       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 5529       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5530       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 5531       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5532       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 5533       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 5534       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 5535       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5536       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 5537       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5538       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 5539       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_WS.
 
 5540       
 5541       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5542       
 5543       PROC SQL;
 5544       CREATE TABLE WORK.GETJOBSDISPBYREFER_WS
 5545       AS
 5546       (
 5547       SELECT
 5548       MAIN.CODE
 5549       ,MAIN.JOB_STATUS
 5550       ,SUM(TTL_JOBS) AS TTL_JOBS
 5551       FROM
 5552       (
 5553       SELECT
 5554         MAIN.CODE
 5555         ,MAIN.JOB_STATUS
 5556         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 5557       FROM
 5558       (
 5559       SELECT
 5560       CODE
 5561       ,JOB_STATUS
 5562       FROM WORK.TBLREFGROUPS_WS
 5563       ) MAIN
 5564       
 5565       LEFT OUTER JOIN
 5566       (
 5567           SELECT
 5568             CASE
 5569               WHEN REFERRED_TO IS NULL
 5570               THEN
 5571                 'OPS'
 5572               ELSE
 5573                 REFERRED_TO
 5574             END AS REFERRED_TO
 5575             ,'DISPATCHED' AS JOB_STATUS
 5576             ,CASE
 5577               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5578                 THEN COUNT(REFERRED_TO)
 5579                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5580             END AS TTL_JOBS
 5581       
 5582           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5583           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 5583     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.')
 5584           GROUP BY REFERRED_TO, JOB_STATUS
 5585       
 5586           UNION
 5587       
 5588           SELECT
 5589             CASE
 5590               WHEN REFERRED_TO IS NULL
 5591               THEN
 5592                 'OPS'
 5593               ELSE
 5594                 REFERRED_TO
 5595             END AS REFERRED_TO
 5596             ,'NOT_DISPATCHED' AS JOB_STATUS
 5597             ,CASE
 5598               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5599                 THEN COUNT(REFERRED_TO)
 5600                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5601             END AS TTL_JOBS
 5602       
 5603           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5604           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 5604     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.')
 5605           GROUP BY REFERRED_TO, JOB_STATUS
 5606       )SUB
 5607       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5608       )
 5609       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 5610       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 5611       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_WS created, with 136 rows and 3 columns.
 
 5612       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 5613       
 5614       PROC SQL;
 5615       CREATE VIEW WORK.SORTTempTableSorted_WS AS
 5616       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 5617       FROM WORK.GETJOBSDISPBYREFER_WS as T
 5618       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_WS has been defined.
 5619       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5620       
 5621       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_WS
 5622       OUT=WORK.TRNSTRANSPOSEDJOBS1_WS(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 5623       NAME=Source
 5624       LABEL=Label
 5625       ;
 5626       BY CODE;
 5627       ID JOB_STATUS;
 5628       VAR TTL_JOBS;
 5629       
 5630       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_WS.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_WS.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_WS has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5631       QUIT;
 5632       
 5633       PROC SQL;
 5634          CREATE TABLE WORK.qryGetJobsDispByRefNot0_WS AS
 5635          SELECT t1.CODE AS REFERRED_TO,
 5636                 t1.DISPATCHED AS JOBS_DISPATCHED,
 5637                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 5638             FROM WORK.TRNSTRANSPOSEDJOBS1_WS t1
 5639             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_WS created, with 1 rows and 3 columns.
 
 5640       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5641       
 5642       PROC SQL;
 5643       CREATE TABLE GETJOBSSURVEY2_WS
 5644       AS
 5645       (
 5646       SELECT
 5647       MAIN.CODE
 5648       ,MAIN.JOB_STATUS
 5649       ,SUM(TTL_JOBS) AS TTL_JOBS
 5650       FROM
 5651       (
 5652       SELECT
 5653         MAIN.CODE
 5654         ,MAIN.JOB_STATUS
 5655         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 5656       FROM
 5657       (
 5658       SELECT
 5659       CODE
 5660       ,JOB_STATUS
 5661       FROM WORK.TBLREFGROUPS_WS
 5662       ) MAIN
 5663       
 5664       LEFT OUTER JOIN
 5665       (
 5666           SELECT
 5667             CASE
 5668               WHEN REFERRED_TO IS NULL
 5669               THEN
 5670                 'OPS'
 5671               ELSE
 5672                 REFERRED_TO
 5673             END AS REFERRED_TO
 5674             ,'DISPATCHED' AS JOB_STATUS
 5675             ,CASE
 5676               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5677                 THEN COUNT(REFERRED_TO)
 5678                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5679             END AS TTL_JOBS
 5680       
 5681           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5682           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 5682     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3
 5682     ! - Western, Suf.')
 5683           GROUP BY REFERRED_TO, JOB_STATUS
 5684       
 5685           UNION
 5686       
 5687           SELECT
 5688             CASE
 5689               WHEN REFERRED_TO IS NULL
 5690               THEN
 5691                 'OPS'
 5692               ELSE
 5693                 REFERRED_TO
 5694             END AS REFERRED_TO
 5695             ,'NOT_DISPATCHED' AS JOB_STATUS
 5696             ,CASE
 5697               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 5698                 THEN COUNT(REFERRED_TO)
 5699                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 5700             END AS TTL_JOBS
 5701       
 5702           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5703           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 5703     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.')
 5704           GROUP BY REFERRED_TO, JOB_STATUS
 5705       )SUB
 5706       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5707       )
 5708       WHERE MAIN.CODE IN ('PRE', 'LKP')
 5709       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 5710       );
 NOTE: Table WORK.GETJOBSSURVEY2_WS created, with 4 rows and 3 columns.
 
 5711       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 5712       
 5713       PROC SQL;
 5714       CREATE VIEW WORK.SORTTempTableSorted_WS AS
 5715       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 5716       FROM WORK.GETJOBSSURVEY2_WS as T
 5717       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_WS has been defined.
 5718       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5719       
 5720       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_WS
 5721       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_WS(LABEL="Transposed WORK.GETJOBSSURVEY2")
 5722       NAME=Source
 5723       LABEL=Label
 5724       ;
 5725       BY CODE;
 5726       ID JOB_STATUS;
 5727       VAR TTL_JOBS;
 5728       
 5729       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_WS.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_WS.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_WS has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5730       QUIT;
 5731       
 5732       PROC SQL;
 5733          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_WS AS
 5734          SELECT t1.CODE AS REFERRED_TO,
 5735                 t1.DISPATCHED AS JOBS_DISPATCHED,
 5736                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 5737             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_WS t1
 5738             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_WS created, with 0 rows and 3 columns.
 
 5739       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5740       
 5741       PROC SQL;
 5742       CREATE TABLE WORK.AppendJobsAndSurvey_WS AS
 5743       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_WS
 5744        OUTER UNION CORR
 5745       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_WS
 5746       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_WS created, with 1 rows and 3 columns.
 
 5747       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5748       
 5749       PROC SQL;
 5750       CREATE TABLE WORK.GETCUSTSURVEY2_WS
 5751       AS
 5752       (
 5753       SELECT
 5754       MAIN.CODE
 5755       ,MAIN.JOB_STATUS
 5756       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5757       FROM
 5758       (
 5759       SELECT
 5760         MAIN.CODE
 5761         ,MAIN.JOB_STATUS
 5762         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 5763       FROM
 5764       (
 5765       SELECT
 5766       CODE
 5767       ,JOB_STATUS
 5768       FROM WORK.TBLREFGROUPS_WS
 5769       ) MAIN
 5770       
 5771       LEFT OUTER JOIN
 5772       (
 5773           SELECT
 5774             CASE
 5775               WHEN REFERRED_TO IS NULL
 5776               THEN
 5777                 'OPS'
 5778               ELSE
 5779                 REFERRED_TO
 5780             END AS REFERRED_TO
 5781             ,'DISPATCHED' AS JOB_STATUS
 5782             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5783       
 5784           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5785           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 5785     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3
 5785     ! - Western, Suf.')
 5786           GROUP BY REFERRED_TO, JOB_STATUS
 5787       
 5788           UNION
 5789       
 5790           SELECT
 5791             CASE
 5792               WHEN REFERRED_TO IS NULL
 5793               THEN
 5794                 'OPS'
 5795               ELSE
 5796                 REFERRED_TO
 5797             END AS REFERRED_TO
 5798             ,'NOT_DISPATCHED' AS JOB_STATUS
 5799             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5800       
 5801           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5802           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 5802     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.')
 5803           GROUP BY REFERRED_TO, JOB_STATUS
 5804       )SUB
 5805       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5806       )
 5807       WHERE MAIN.CODE IN ('PRE', 'LKP')
 5808       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 5809       );
 NOTE: Table WORK.GETCUSTSURVEY2_WS created, with 4 rows and 3 columns.
 
 5810       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 5811       
 5812       PROC SQL;
 5813       CREATE VIEW WORK.SORTTempTableSorted_WS AS
 5814       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 5815       FROM WORK.GETCUSTSURVEY2_WS as T
 5816       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_WS has been defined.
 5817       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5818       
 5819       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_WS
 5820       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_WS(LABEL="Transposed WORK.GETCUSTSURVEY2")
 5821       NAME=Source
 5822       LABEL=Label
 5823       ;
 5824       BY CODE;
 5825       ID JOB_STATUS;
 5826       VAR TTL_CUST_OUT;
 5827       
 5828       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_WS.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_WS.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_WS has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 5829       QUIT;
 5830       
 5831       PROC SQL;
 5832          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_WS AS
 5833          SELECT t1.CODE AS REFERRED_TO,
 5834                 t1.DISPATCHED AS CUST_DISPATCHED,
 5835                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 5836             FROM WORK.TRNSTRANSPOSEDSURVCUST1_WS t1
 5837             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;

 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_WS created, with 0 rows and 3 columns.
 
 5838       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5839       
 5840       PROC SQL;
 5841       CREATE TABLE WORK.GETCUSTDISPBYREFER_WS
 5842       AS
 5843       (
 5844       SELECT
 5845       MAIN.CODE
 5846       ,MAIN.JOB_STATUS
 5847       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5848       FROM
 5849       (
 5850       SELECT
 5851         MAIN.CODE
 5852         ,MAIN.JOB_STATUS
 5853         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 5854       FROM
 5855       (
 5856       SELECT
 5857       CODE
 5858       ,JOB_STATUS
 5859       FROM WORK.TBLREFGROUPS_WS
 5860       ) MAIN
 5861       
 5862       LEFT OUTER JOIN
 5863       (
 5864           SELECT
 5865             CASE
 5866               WHEN REFERRED_TO IS NULL
 5867               THEN
 5868                 'OPS'
 5869               ELSE
 5870                 REFERRED_TO
 5871             END AS REFERRED_TO
 5872             ,'DISPATCHED' AS JOB_STATUS
 5873             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5874       
 5875           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5876           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 5876     ! MISSING) AND DISTRICT IN ('3 - Western, Suf.')
 5877           GROUP BY REFERRED_TO, JOB_STATUS
 5878       
 5879           UNION
 5880       
 5881           SELECT
 5882             CASE
 5883               WHEN REFERRED_TO IS NULL
 5884               THEN
 5885                 'OPS'
 5886               ELSE
 5887                 REFERRED_TO
 5888             END AS REFERRED_TO
 5889             ,'NOT_DISPATCHED' AS JOB_STATUS
 5890             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 5891       
 5892           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 5893           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 5893     ! MISSING) AND DISTRICT IN ('3 - Western, Suf.')
 5894           GROUP BY REFERRED_TO, JOB_STATUS
 5895       )SUB
 5896       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 5897       )
 5898       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 5899       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 5900       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_WS created, with 136 rows and 3 columns.
 
 5901       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 5902       
 5903       PROC SQL;
 5904       CREATE VIEW WORK.SORTTempTableSorted_WS AS
 5905       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 5906       FROM WORK.GETCUSTDISPBYREFER_WS as T
 5907       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_WS has been defined.
 5908       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5909       
 5910       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_WS
 5911       OUT=WORK.TRNSTRANSPOSEDCUSTS1_WS(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 5912       NAME=Source
 5913       LABEL=Label
 5914       ;
 5915       BY CODE;
 5916       ID JOB_STATUS;
 5917       VAR TTL_CUST_OUT;
 5918       
 5919       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_WS.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_WS.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_WS has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5920       QUIT;
 5921       
 5922       PROC SQL;
 5923          CREATE TABLE WORK.qryGetCustDispByRefNot0_WS AS
 5924          SELECT t1.CODE AS REFERRED_TO,
 5925                 t1.DISPATCHED AS CUST_DISPATCHED,
 5926                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 5927             FROM WORK.TRNSTRANSPOSEDCUSTS1_WS t1
 5928             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_WS created, with 1 rows and 3 columns.
 
 5929       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5930       
 5931       PROC SQL;
 5932       CREATE TABLE WORK.AppendCustAndSurvey_WS AS
 5933       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_WS
 5934        OUTER UNION CORR
 5935       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_WS
 5936       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_WS created, with 1 rows and 3 columns.
 
 5937       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5938       
 5939       PROC SQL;
 5940          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_WS AS
 5941          SELECT
 5942            ('3 - Western, Suf.') AS DIVISION,
 5943            t4.REFERRED_TO,
 5944                 t1.CUST_DISPATCHED,
 5945                 t1.CUST_NOT_DISPATCHED,
 5946                 t4.JOBS_DISPATCHED,
 5947                 t4.JOBS_NOT_DISPATCHED,
 5948                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 5949                 t3.ALL_JOBS_OUT AS ALL_JOBS
 5950             FROM WORK.QRYALLJOBSCUSTBYREFGRP_WS t3, WORK.APPENDJOBSANDSURVEY_WS t4, WORK.APPENDCUSTANDSURVEY_WS t1
 5951             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_WS created, with 1 rows and 8 columns.
 
 5952       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 5953       
 5954       /* ************************************************************** WS
 5954     ! ************************************************************** */
 5955       
 5956       /* ************************************************************** ES
 5956     ! ************************************************************** */
 5957       
 5958       PROC SQL;
 5959          CREATE TABLE WORK.qryAllJobsCustByRefGrp_ES AS
 5960          SELECT /* REFERRED_TO */
 5961                   (CASE
 5962                     WHEN t1.REFERRED_TO IS NULL
 5963                       THEN 'OPS'
 5964                        ELSE t1.REFERRED_TO
 5965                   END) AS REFERRED_TO,
 5966                 /* ALL_CUST_OUT */
 5967                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 5968                 /* ALL_JOBS_OUT */
 5969                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 5970             FROM WORK.QRYSTORM_FMT_DATES t1
 5971             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 5971     ! t1.DISTRICT IN ('4 - Eastern, Suf.')
 5972             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_ES created, with 1 rows and 3 columns.
 
 5973       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 5974       
 5975       proc sql;
 5976          create table WORK.TBLREFGROUPS_ES
 5977          (
 5978       CODE char(12),
 5979               DESC char(50),
 5980               JOB_STATUS char(20)
 5981          );
 NOTE: Table WORK.TBLREFGROUPS_ES created, with 0 rows and 3 columns.
 5982       
 5983       insert into WORK.TBLREFGROUPS_ES
 5984       
 5985       VALUES('AMI','AMI','DISPATCHED')
 5986       VALUES('AMI','AMI','NOT_DISPATCHED')
 5987       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 5988       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 5989       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 5990       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 5991       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 5992       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5993       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 5994       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 5995       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 5996       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 5997       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 5998       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 5999       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 6000       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6001       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 6002       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6003       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 6004       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 6005       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 6006       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 6007       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 6008       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 6009       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 6010       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 6011       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 6012       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 6013       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 6014       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 6015       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 6016       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 6017       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 6018       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 6019       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 6020       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 6021       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 6022       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 6023       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 6024       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6025       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 6026       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 6027       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 6028       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 6029       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 6030       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 6031       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 6032       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 6033       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 6034       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 6035       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 6036       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 6037       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 6038       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 6039       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 6040       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 6041       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 6042       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 6043       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 6044       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 6045       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 6046       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6047       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 6048       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 6049       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 6050       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 6051       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 6052       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 6053       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 6054       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 6055       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 6056       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 6057       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 6058       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 6059       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 6060       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 6061       VALUES('MA37','SRO1','DISPATCHED')
 6062       VALUES('MA37','SRO1','NOT_DISPATCHED')
 6063       VALUES('MA38','SRO2','DISPATCHED')
 6064       VALUES('MA38','SRO2','NOT_DISPATCHED')
 6065       VALUES('MA39','SRO3','DISPATCHED')
 6066       VALUES('MA39','SRO3','NOT_DISPATCHED')
 6067       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 6068       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6069       VALUES('MA40','SRO4','DISPATCHED')
 6070       VALUES('MA40','SRO4','NOT_DISPATCHED')
 6071       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 6072       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6073       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 6074       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6075       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 6076       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6077       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 6078       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6079       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 6080       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6081       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 6082       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 6083       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 6084       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 6085       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 6086       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 6087       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 6088       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 6089       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 6090       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6091       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 6092       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 6093       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 6094       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 6095       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 6096       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6097       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 6098       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 6099       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 6100       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 6101       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 6102       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 6103       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 6104       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 6105       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 6106       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 6107       VALUES('RFS','REFER TO SPT','DISPATCHED')
 6108       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 6109       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 6110       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 6111       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 6112       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 6113       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 6114       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6115       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 6116       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6117       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 6118       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 6119       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 6120       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6121       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 6122       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6123       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 6124       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_ES.
 
 6125       
 6126       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6127       
 6128       PROC SQL;
 6129       CREATE TABLE WORK.GETJOBSDISPBYREFER_ES
 6130       AS
 6131       (
 6132       SELECT
 6133       MAIN.CODE
 6134       ,MAIN.JOB_STATUS
 6135       ,SUM(TTL_JOBS) AS TTL_JOBS
 6136       FROM
 6137       (
 6138       SELECT
 6139         MAIN.CODE
 6140         ,MAIN.JOB_STATUS
 6141         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 6142       FROM
 6143       (
 6144       SELECT
 6145       CODE
 6146       ,JOB_STATUS
 6147       FROM WORK.TBLREFGROUPS_ES
 6148       ) MAIN
 6149       
 6150       LEFT OUTER JOIN
 6151       (
 6152           SELECT
 6153             CASE
 6154               WHEN REFERRED_TO IS NULL
 6155               THEN
 6156                 'OPS'
 6157               ELSE
 6158                 REFERRED_TO
 6159             END AS REFERRED_TO
 6160             ,'DISPATCHED' AS JOB_STATUS
 6161             ,CASE
 6162               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6163                 THEN COUNT(REFERRED_TO)
 6164                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6165             END AS TTL_JOBS
 6166       
 6167           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6168           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 6168     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('4 - Eastern, Suf.')
 6169           GROUP BY REFERRED_TO, JOB_STATUS
 6170       
 6171           UNION
 6172       
 6173           SELECT
 6174             CASE
 6175               WHEN REFERRED_TO IS NULL
 6176               THEN
 6177                 'OPS'
 6178               ELSE
 6179                 REFERRED_TO
 6180             END AS REFERRED_TO
 6181             ,'NOT_DISPATCHED' AS JOB_STATUS
 6182             ,CASE
 6183               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6184                 THEN COUNT(REFERRED_TO)
 6185                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6186             END AS TTL_JOBS
 6187       
 6188           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6189           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 6189     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('4 - Eastern, Suf.')
 6190           GROUP BY REFERRED_TO, JOB_STATUS
 6191       )SUB
 6192       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6193       )
 6194       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 6195       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 6196       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_ES created, with 136 rows and 3 columns.
 
 6197       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 6198       
 6199       PROC SQL;
 6200       CREATE VIEW WORK.SORTTempTableSorted_ES AS
 6201       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 6202       FROM WORK.GETJOBSDISPBYREFER_ES as T
 6203       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ES has been defined.
 6204       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6205       
 6206       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ES
 6207       OUT=WORK.TRNSTRANSPOSEDJOBS1_ES(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 6208       NAME=Source
 6209       LABEL=Label
 6210       ;
 6211       BY CODE;
 6212       ID JOB_STATUS;
 6213       VAR TTL_JOBS;
 6214       
 6215       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_ES.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_ES.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_ES has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6216       QUIT;
 6217       
 6218       PROC SQL;
 6219          CREATE TABLE WORK.qryGetJobsDispByRefNot0_ES AS
 6220          SELECT t1.CODE AS REFERRED_TO,
 6221                 t1.DISPATCHED AS JOBS_DISPATCHED,
 6222                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 6223             FROM WORK.TRNSTRANSPOSEDJOBS1_ES t1
 6224             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_ES created, with 1 rows and 3 columns.
 
 6225       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6226       
 6227       PROC SQL;
 6228       CREATE TABLE GETJOBSSURVEY2_ES
 6229       AS
 6230       (
 6231       SELECT
 6232       MAIN.CODE
 6233       ,MAIN.JOB_STATUS
 6234       ,SUM(TTL_JOBS) AS TTL_JOBS
 6235       FROM
 6236       (
 6237       SELECT
 6238         MAIN.CODE
 6239         ,MAIN.JOB_STATUS
 6240         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 6241       FROM
 6242       (
 6243       SELECT
 6244       CODE
 6245       ,JOB_STATUS
 6246       FROM WORK.TBLREFGROUPS_ES
 6247       ) MAIN
 6248       
 6249       LEFT OUTER JOIN
 6250       (
 6251           SELECT
 6252             CASE
 6253               WHEN REFERRED_TO IS NULL
 6254               THEN
 6255                 'OPS'
 6256               ELSE
 6257                 REFERRED_TO
 6258             END AS REFERRED_TO
 6259             ,'DISPATCHED' AS JOB_STATUS
 6260             ,CASE
 6261               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6262                 THEN COUNT(REFERRED_TO)
 6263                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6264             END AS TTL_JOBS
 6265       
 6266           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6267           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 6267     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('4
 6267     ! - Eastern, Suf.')
 6268           GROUP BY REFERRED_TO, JOB_STATUS
 6269       
 6270           UNION
 6271       
 6272           SELECT
 6273             CASE
 6274               WHEN REFERRED_TO IS NULL
 6275               THEN
 6276                 'OPS'
 6277               ELSE
 6278                 REFERRED_TO
 6279             END AS REFERRED_TO
 6280             ,'NOT_DISPATCHED' AS JOB_STATUS
 6281             ,CASE
 6282               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6283                 THEN COUNT(REFERRED_TO)
 6284                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6285             END AS TTL_JOBS
 6286       
 6287           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6288           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 6288     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('4 - Eastern, Suf.')
 6289           GROUP BY REFERRED_TO, JOB_STATUS
 6290       )SUB
 6291       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6292       )
 6293       WHERE MAIN.CODE IN ('PRE', 'LKP')
 6294       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 6295       );
 NOTE: Table WORK.GETJOBSSURVEY2_ES created, with 4 rows and 3 columns.
 
 6296       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 6297       
 6298       PROC SQL;
 6299       CREATE VIEW WORK.SORTTempTableSorted_ES AS
 6300       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 6301       FROM WORK.GETJOBSSURVEY2_ES as T
 6302       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ES has been defined.
 6303       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6304       
 6305       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ES
 6306       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_ES(LABEL="Transposed WORK.GETJOBSSURVEY2")
 6307       NAME=Source
 6308       LABEL=Label
 6309       ;
 6310       BY CODE;
 6311       ID JOB_STATUS;
 6312       VAR TTL_JOBS;
 6313       
 6314       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_ES.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_ES.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_ES has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6315       QUIT;
 6316       
 6317       PROC SQL;
 6318          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_ES AS
 6319          SELECT t1.CODE AS REFERRED_TO,
 6320                 t1.DISPATCHED AS JOBS_DISPATCHED,
 6321                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 6322             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_ES t1
 6323             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_ES created, with 0 rows and 3 columns.
 
 6324       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6325       
 6326       PROC SQL;
 6327       CREATE TABLE WORK.AppendJobsAndSurvey_ES AS
 6328       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_ES
 6329        OUTER UNION CORR
 6330       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_ES
 6331       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_ES created, with 1 rows and 3 columns.
 
 6332       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6333       
 6334       PROC SQL;
 6335       CREATE TABLE WORK.GETCUSTSURVEY2_ES
 6336       AS
 6337       (
 6338       SELECT
 6339       MAIN.CODE
 6340       ,MAIN.JOB_STATUS
 6341       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6342       FROM
 6343       (
 6344       SELECT
 6345         MAIN.CODE
 6346         ,MAIN.JOB_STATUS
 6347         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 6348       FROM
 6349       (
 6350       SELECT
 6351       CODE
 6352       ,JOB_STATUS
 6353       FROM WORK.TBLREFGROUPS_ES
 6354       ) MAIN
 6355       
 6356       LEFT OUTER JOIN
 6357       (
 6358           SELECT
 6359             CASE
 6360               WHEN REFERRED_TO IS NULL
 6361               THEN
 6362                 'OPS'
 6363               ELSE
 6364                 REFERRED_TO
 6365             END AS REFERRED_TO
 6366             ,'DISPATCHED' AS JOB_STATUS
 6367             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6368       
 6369           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6370           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 6370     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('4
 6370     ! - Eastern, Suf.')
 6371           GROUP BY REFERRED_TO, JOB_STATUS
 6372       
 6373           UNION
 6374       
 6375           SELECT
 6376             CASE
 6377               WHEN REFERRED_TO IS NULL
 6378               THEN
 6379                 'OPS'
 6380               ELSE
 6381                 REFERRED_TO
 6382             END AS REFERRED_TO
 6383             ,'NOT_DISPATCHED' AS JOB_STATUS
 6384             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6385       
 6386           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6387           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 6387     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('4 - Eastern, Suf.')
 6388           GROUP BY REFERRED_TO, JOB_STATUS
 6389       )SUB
 6390       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6391       )
 6392       WHERE MAIN.CODE IN ('PRE', 'LKP')
 6393       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 6394       );
 NOTE: Table WORK.GETCUSTSURVEY2_ES created, with 4 rows and 3 columns.
 
 6395       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 6396       
 6397       PROC SQL;
 6398       CREATE VIEW WORK.SORTTempTableSorted_ES AS
 6399       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 6400       FROM WORK.GETCUSTSURVEY2_ES as T
 6401       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ES has been defined.
 6402       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6403       
 6404       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ES
 6405       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_ES(LABEL="Transposed WORK.GETCUSTSURVEY2")
 6406       NAME=Source
 6407       LABEL=Label
 6408       ;
 6409       BY CODE;
 6410       ID JOB_STATUS;
 6411       VAR TTL_CUST_OUT;
 6412       
 6413       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_ES.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_ES.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_ES has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6414       QUIT;
 6415       
 6416       PROC SQL;
 6417          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_ES AS
 6418          SELECT t1.CODE AS REFERRED_TO,
 6419                 t1.DISPATCHED AS CUST_DISPATCHED,
 6420                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 6421             FROM WORK.TRNSTRANSPOSEDSURVCUST1_ES t1
 6422             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_ES created, with 0 rows and 3 columns.
 
 6423       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6424       
 6425       PROC SQL;
 6426       CREATE TABLE WORK.GETCUSTDISPBYREFER_ES
 6427       AS
 6428       (
 6429       SELECT
 6430       MAIN.CODE
 6431       ,MAIN.JOB_STATUS
 6432       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6433       FROM
 6434       (
 6435       SELECT
 6436         MAIN.CODE
 6437         ,MAIN.JOB_STATUS
 6438         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 6439       FROM
 6440       (
 6441       SELECT
 6442       CODE
 6443       ,JOB_STATUS
 6444       FROM WORK.TBLREFGROUPS_ES
 6445       ) MAIN
 6446       
 6447       LEFT OUTER JOIN
 6448       (
 6449           SELECT
 6450             CASE
 6451               WHEN REFERRED_TO IS NULL
 6452               THEN
 6453                 'OPS'
 6454               ELSE
 6455                 REFERRED_TO
 6456             END AS REFERRED_TO
 6457             ,'DISPATCHED' AS JOB_STATUS
 6458             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6459       
 6460           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6461           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 6461     ! MISSING) AND DISTRICT IN ('4 - Eastern, Suf.')
 6462           GROUP BY REFERRED_TO, JOB_STATUS
 6463       
 6464           UNION
 6465       
 6466           SELECT
 6467             CASE
 6468               WHEN REFERRED_TO IS NULL
 6469               THEN
 6470                 'OPS'
 6471               ELSE
 6472                 REFERRED_TO
 6473             END AS REFERRED_TO
 6474             ,'NOT_DISPATCHED' AS JOB_STATUS
 6475             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6476       
 6477           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6478           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 6478     ! MISSING) AND DISTRICT IN ('4 - Eastern, Suf.')
 6479           GROUP BY REFERRED_TO, JOB_STATUS
 6480       )SUB
 6481       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6482       )
 6483       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 6484       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 6485       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_ES created, with 136 rows and 3 columns.
 
 6486       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 6487       
 6488       PROC SQL;
 6489       CREATE VIEW WORK.SORTTempTableSorted_ES AS
 6490       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 6491       FROM WORK.GETCUSTDISPBYREFER_ES as T
 6492       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_ES has been defined.
 6493       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6494       
 6495       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_ES
 6496       OUT=WORK.TRNSTRANSPOSEDCUSTS1_ES(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 6497       NAME=Source
 6498       LABEL=Label
 6499       ;
 6500       BY CODE;
 6501       ID JOB_STATUS;
 6502       VAR TTL_CUST_OUT;
 6503       
 6504       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_ES.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_ES.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_ES has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6505       QUIT;
 6506       
 6507       PROC SQL;
 6508          CREATE TABLE WORK.qryGetCustDispByRefNot0_ES AS
 6509          SELECT t1.CODE AS REFERRED_TO,
 6510                 t1.DISPATCHED AS CUST_DISPATCHED,
 6511                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 6512             FROM WORK.TRNSTRANSPOSEDCUSTS1_ES t1
 6513             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_ES created, with 1 rows and 3 columns.
 
 6514       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6515       
 6516       PROC SQL;
 6517       CREATE TABLE WORK.AppendCustAndSurvey_ES AS
 6518       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_ES
 6519        OUTER UNION CORR
 6520       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_ES
 6521       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_ES created, with 1 rows and 3 columns.
 
 6522       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6523       
 6524       PROC SQL;
 6525          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_ES AS
 6526          SELECT
 6527            ('4 - Eastern, Suf.') AS DIVISION,
 6528            t4.REFERRED_TO,
 6529                 t1.CUST_DISPATCHED,
 6530                 t1.CUST_NOT_DISPATCHED,
 6531                 t4.JOBS_DISPATCHED,
 6532                 t4.JOBS_NOT_DISPATCHED,
 6533                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 6534                 t3.ALL_JOBS_OUT AS ALL_JOBS
 6535             FROM WORK.QRYALLJOBSCUSTBYREFGRP_ES t3, WORK.APPENDJOBSANDSURVEY_ES t4, WORK.APPENDCUSTANDSURVEY_ES t1
 6536             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_ES created, with 1 rows and 8 columns.
 
 6537       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 6538       
 6539       /* ************************************************************** ES
 6539     ! ************************************************************** */
 6540       
 6541       /* ************************************************************** NAS
 6541     ! ************************************************************** */
 6542       
 6543       PROC SQL;
 6544          CREATE TABLE WORK.qryAllJobsCustByRefGrp_NAS AS
 6545          SELECT /* REFERRED_TO */
 6546                   (CASE
 6547                     WHEN t1.REFERRED_TO IS NULL
 6548                       THEN 'OPS'
 6549                        ELSE t1.REFERRED_TO
 6550                   END) AS REFERRED_TO,
 6551                 /* ALL_CUST_OUT */
 6552                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 6553                 /* ALL_JOBS_OUT */
 6554                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 6555             FROM WORK.QRYSTORM_FMT_DATES t1
 6556             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 6556     ! t1.DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 6557             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_NAS created, with 1 rows and 3 columns.
 
 6558       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6559       
 6560       proc sql;
 6561          create table WORK.TBLREFGROUPS_NAS
 6562          (
 6563       CODE char(12),
 6564               DESC char(50),
 6565               JOB_STATUS char(20)
 6566          );
 NOTE: Table WORK.TBLREFGROUPS_NAS created, with 0 rows and 3 columns.
 6567       
 6568       insert into WORK.TBLREFGROUPS_NAS
 6569       
 6570       VALUES('AMI','AMI','DISPATCHED')
 6571       VALUES('AMI','AMI','NOT_DISPATCHED')
 6572       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 6573       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 6574       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 6575       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 6576       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 6577       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6578       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 6579       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 6580       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 6581       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 6582       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 6583       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6584       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 6585       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6586       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 6587       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6588       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 6589       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 6590       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 6591       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 6592       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 6593       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 6594       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 6595       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 6596       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 6597       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 6598       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 6599       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 6600       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 6601       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 6602       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 6603       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 6604       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 6605       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 6606       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 6607       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 6608       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 6609       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6610       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 6611       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 6612       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 6613       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 6614       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 6615       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 6616       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 6617       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 6618       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 6619       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 6620       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 6621       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 6622       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 6623       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 6624       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 6625       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 6626       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 6627       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 6628       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 6629       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 6630       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 6631       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6632       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 6633       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 6634       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 6635       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 6636       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 6637       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 6638       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 6639       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 6640       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 6641       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 6642       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 6643       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 6644       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 6645       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 6646       VALUES('MA37','SRO1','DISPATCHED')
 6647       VALUES('MA37','SRO1','NOT_DISPATCHED')
 6648       VALUES('MA38','SRO2','DISPATCHED')
 6649       VALUES('MA38','SRO2','NOT_DISPATCHED')
 6650       VALUES('MA39','SRO3','DISPATCHED')
 6651       VALUES('MA39','SRO3','NOT_DISPATCHED')
 6652       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 6653       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6654       VALUES('MA40','SRO4','DISPATCHED')
 6655       VALUES('MA40','SRO4','NOT_DISPATCHED')
 6656       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 6657       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6658       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 6659       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6660       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 6661       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6662       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 6663       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6664       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 6665       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6666       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 6667       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 6668       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 6669       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 6670       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 6671       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 6672       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 6673       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 6674       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 6675       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6676       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 6677       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 6678       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 6679       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 6680       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 6681       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6682       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 6683       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 6684       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 6685       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 6686       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 6687       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 6688       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 6689       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 6690       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 6691       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 6692       VALUES('RFS','REFER TO SPT','DISPATCHED')
 6693       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 6694       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 6695       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 6696       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 6697       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 6698       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 6699       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6700       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 6701       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6702       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 6703       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 6704       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 6705       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6706       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 6707       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 6708       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 6709       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_NAS.
 
 6710       
 6711       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6712       
 6713       PROC SQL;
 6714       CREATE TABLE WORK.GETJOBSDISPBYREFER_NAS
 6715       AS
 6716       (
 6717       SELECT
 6718       MAIN.CODE
 6719       ,MAIN.JOB_STATUS
 6720       ,SUM(TTL_JOBS) AS TTL_JOBS
 6721       FROM
 6722       (
 6723       SELECT
 6724         MAIN.CODE
 6725         ,MAIN.JOB_STATUS
 6726         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 6727       FROM
 6728       (
 6729       SELECT
 6730       CODE
 6731       ,JOB_STATUS
 6732       FROM WORK.TBLREFGROUPS_NAS
 6733       ) MAIN
 6734       
 6735       LEFT OUTER JOIN
 6736       (
 6737           SELECT
 6738             CASE
 6739               WHEN REFERRED_TO IS NULL
 6740               THEN
 6741                 'OPS'
 6742               ELSE
 6743                 REFERRED_TO
 6744             END AS REFERRED_TO
 6745             ,'DISPATCHED' AS JOB_STATUS
 6746             ,CASE
 6747               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6748                 THEN COUNT(REFERRED_TO)
 6749                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6750             END AS TTL_JOBS
 6751       
 6752           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6753           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 6753     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 6754           GROUP BY REFERRED_TO, JOB_STATUS
 6755       
 6756           UNION
 6757       
 6758           SELECT
 6759             CASE
 6760               WHEN REFERRED_TO IS NULL
 6761               THEN
 6762                 'OPS'
 6763               ELSE
 6764                 REFERRED_TO
 6765             END AS REFERRED_TO
 6766             ,'NOT_DISPATCHED' AS JOB_STATUS
 6767             ,CASE
 6768               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6769                 THEN COUNT(REFERRED_TO)
 6770                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6771             END AS TTL_JOBS
 6772       
 6773           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6774           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 6774     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 6775           GROUP BY REFERRED_TO, JOB_STATUS
 6776       )SUB
 6777       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6778       )
 6779       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 6780       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 6781       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_NAS created, with 136 rows and 3 columns.
 
 6782       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 6783       
 6784       PROC SQL;
 6785       CREATE VIEW WORK.SORTTempTableSorted_NAS AS
 6786       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 6787       FROM WORK.GETJOBSDISPBYREFER_NAS as T
 6788       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_NAS has been defined.
 6789       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6790       
 6791       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_NAS
 6792       OUT=WORK.TRNSTRANSPOSEDJOBS1_NAS(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 6793       NAME=Source
 6794       LABEL=Label
 6795       ;
 6796       BY CODE;
 6797       ID JOB_STATUS;
 6798       VAR TTL_JOBS;
 6799       
 6800       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_NAS.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_NAS.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_NAS has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6801       QUIT;
 6802       
 6803       PROC SQL;
 6804          CREATE TABLE WORK.qryGetJobsDispByRefNot0_NAS AS
 6805          SELECT t1.CODE AS REFERRED_TO,
 6806                 t1.DISPATCHED AS JOBS_DISPATCHED,
 6807                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 6808             FROM WORK.TRNSTRANSPOSEDJOBS1_NAS t1
 6809             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_NAS created, with 1 rows and 3 columns.
 
 6810       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6811       
 6812       PROC SQL;
 6813       CREATE TABLE GETJOBSSURVEY2_NAS
 6814       AS
 6815       (
 6816       SELECT
 6817       MAIN.CODE
 6818       ,MAIN.JOB_STATUS
 6819       ,SUM(TTL_JOBS) AS TTL_JOBS
 6820       FROM
 6821       (
 6822       SELECT
 6823         MAIN.CODE
 6824         ,MAIN.JOB_STATUS
 6825         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 6826       FROM
 6827       (
 6828       SELECT
 6829       CODE
 6830       ,JOB_STATUS
 6831       FROM WORK.TBLREFGROUPS_NAS
 6832       ) MAIN
 6833       
 6834       LEFT OUTER JOIN
 6835       (
 6836           SELECT
 6837             CASE
 6838               WHEN REFERRED_TO IS NULL
 6839               THEN
 6840                 'OPS'
 6841               ELSE
 6842                 REFERRED_TO
 6843             END AS REFERRED_TO
 6844             ,'DISPATCHED' AS JOB_STATUS
 6845             ,CASE
 6846               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6847                 THEN COUNT(REFERRED_TO)
 6848                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6849             END AS TTL_JOBS
 6850       
 6851           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6852           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 6852     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1
 6852     ! - Queens, Nas.', '2 - Central, Nas.')
 6853           GROUP BY REFERRED_TO, JOB_STATUS
 6854       
 6855           UNION
 6856       
 6857           SELECT
 6858             CASE
 6859               WHEN REFERRED_TO IS NULL
 6860               THEN
 6861                 'OPS'
 6862               ELSE
 6863                 REFERRED_TO
 6864             END AS REFERRED_TO
 6865             ,'NOT_DISPATCHED' AS JOB_STATUS
 6866             ,CASE
 6867               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 6868                 THEN COUNT(REFERRED_TO)
 6869                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 6870             END AS TTL_JOBS
 6871       
 6872           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6873           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 6873     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central,
 6873     !  Nas.')
 6874           GROUP BY REFERRED_TO, JOB_STATUS
 6875       )SUB
 6876       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6877       )
 6878       WHERE MAIN.CODE IN ('PRE', 'LKP')
 6879       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 6880       );
 NOTE: Table WORK.GETJOBSSURVEY2_NAS created, with 4 rows and 3 columns.
 
 6881       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 6882       
 6883       PROC SQL;
 6884       CREATE VIEW WORK.SORTTempTableSorted_NAS AS
 6885       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 6886       FROM WORK.GETJOBSSURVEY2_NAS as T
 6887       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_NAS has been defined.
 6888       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6889       
 6890       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_NAS
 6891       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_NAS(LABEL="Transposed WORK.GETJOBSSURVEY2")
 6892       NAME=Source
 6893       LABEL=Label
 6894       ;
 6895       BY CODE;
 6896       ID JOB_STATUS;
 6897       VAR TTL_JOBS;
 6898       
 6899       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_NAS.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_NAS.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_NAS has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6900       QUIT;
 6901       
 6902       PROC SQL;
 6903          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_NAS AS
 6904          SELECT t1.CODE AS REFERRED_TO,
 6905                 t1.DISPATCHED AS JOBS_DISPATCHED,
 6906                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 6907             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_NAS t1
 6908             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_NAS created, with 0 rows and 3 columns.
 
 6909       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 6910       
 6911       PROC SQL;
 6912       CREATE TABLE WORK.AppendJobsAndSurvey_NAS AS
 6913       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_NAS
 6914        OUTER UNION CORR
 6915       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_NAS
 6916       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_NAS created, with 1 rows and 3 columns.
 
 6917       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6918       
 6919       PROC SQL;
 6920       CREATE TABLE WORK.GETCUSTSURVEY2_NAS
 6921       AS
 6922       (
 6923       SELECT
 6924       MAIN.CODE
 6925       ,MAIN.JOB_STATUS
 6926       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6927       FROM
 6928       (
 6929       SELECT
 6930         MAIN.CODE
 6931         ,MAIN.JOB_STATUS
 6932         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 6933       FROM
 6934       (
 6935       SELECT
 6936       CODE
 6937       ,JOB_STATUS
 6938       FROM WORK.TBLREFGROUPS_NAS
 6939       ) MAIN
 6940       
 6941       LEFT OUTER JOIN
 6942       (
 6943           SELECT
 6944             CASE
 6945               WHEN REFERRED_TO IS NULL
 6946               THEN
 6947                 'OPS'
 6948               ELSE
 6949                 REFERRED_TO
 6950             END AS REFERRED_TO
 6951             ,'DISPATCHED' AS JOB_STATUS
 6952             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6953       
 6954           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6955           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 6955     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1
 6955     ! - Queens, Nas.', '2 - Central, Nas.')
 6956           GROUP BY REFERRED_TO, JOB_STATUS
 6957       
 6958           UNION
 6959       
 6960           SELECT
 6961             CASE
 6962               WHEN REFERRED_TO IS NULL
 6963               THEN
 6964                 'OPS'
 6965               ELSE
 6966                 REFERRED_TO
 6967             END AS REFERRED_TO
 6968             ,'NOT_DISPATCHED' AS JOB_STATUS
 6969             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 6970       
 6971           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 6972           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 6972     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central,
 6972     !  Nas.')
 6973           GROUP BY REFERRED_TO, JOB_STATUS
 6974       )SUB
 6975       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 6976       )
 6977       WHERE MAIN.CODE IN ('PRE', 'LKP')
 6978       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 6979       );
 NOTE: Table WORK.GETCUSTSURVEY2_NAS created, with 4 rows and 3 columns.
 
 6980       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 6981       
 6982       PROC SQL;
 6983       CREATE VIEW WORK.SORTTempTableSorted_NAS AS
 6984       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 6985       FROM WORK.GETCUSTSURVEY2_NAS as T
 6986       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_NAS has been defined.
 6987       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6988       
 6989       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_NAS
 6990       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_NAS(LABEL="Transposed WORK.GETCUSTSURVEY2")
 6991       NAME=Source
 6992       LABEL=Label
 6993       ;
 6994       BY CODE;
 6995       ID JOB_STATUS;
 6996       VAR TTL_CUST_OUT;
 6997       
 6998       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_NAS.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_NAS.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_NAS has 2 observations and 4 variables.

 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 6999       QUIT;
 7000       
 7001       PROC SQL;
 7002          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_NAS AS
 7003          SELECT t1.CODE AS REFERRED_TO,
 7004                 t1.DISPATCHED AS CUST_DISPATCHED,
 7005                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 7006             FROM WORK.TRNSTRANSPOSEDSURVCUST1_NAS t1
 7007             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_NAS created, with 0 rows and 3 columns.
 
 7008       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7009       
 7010       PROC SQL;
 7011       CREATE TABLE WORK.GETCUSTDISPBYREFER_NAS
 7012       AS
 7013       (
 7014       SELECT
 7015       MAIN.CODE
 7016       ,MAIN.JOB_STATUS
 7017       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7018       FROM
 7019       (
 7020       SELECT
 7021         MAIN.CODE
 7022         ,MAIN.JOB_STATUS
 7023         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 7024       FROM
 7025       (
 7026       SELECT
 7027       CODE
 7028       ,JOB_STATUS
 7029       FROM WORK.TBLREFGROUPS_NAS
 7030       ) MAIN
 7031       
 7032       LEFT OUTER JOIN
 7033       (
 7034           SELECT
 7035             CASE
 7036               WHEN REFERRED_TO IS NULL
 7037               THEN
 7038                 'OPS'
 7039               ELSE
 7040                 REFERRED_TO
 7041             END AS REFERRED_TO
 7042             ,'DISPATCHED' AS JOB_STATUS
 7043             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7044       
 7045           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7046           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 7046     ! MISSING) AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 7047           GROUP BY REFERRED_TO, JOB_STATUS
 7048       
 7049           UNION
 7050       
 7051           SELECT
 7052             CASE
 7053               WHEN REFERRED_TO IS NULL
 7054               THEN
 7055                 'OPS'
 7056               ELSE
 7057                 REFERRED_TO
 7058             END AS REFERRED_TO
 7059             ,'NOT_DISPATCHED' AS JOB_STATUS
 7060             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7061       
 7062           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7063           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 7063     ! MISSING) AND DISTRICT IN ('1 - Queens, Nas.', '2 - Central, Nas.')
 7064           GROUP BY REFERRED_TO, JOB_STATUS
 7065       )SUB
 7066       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 7067       )
 7068       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 7069       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 7070       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_NAS created, with 136 rows and 3 columns.
 
 7071       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 7072       
 7073       PROC SQL;
 7074       CREATE VIEW WORK.SORTTempTableSorted_NAS AS
 7075       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 7076       FROM WORK.GETCUSTDISPBYREFER_NAS as T
 7077       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_NAS has been defined.
 7078       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7079       
 7080       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_NAS
 7081       OUT=WORK.TRNSTRANSPOSEDCUSTS1_NAS(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 7082       NAME=Source
 7083       LABEL=Label
 7084       ;
 7085       BY CODE;
 7086       ID JOB_STATUS;
 7087       VAR TTL_CUST_OUT;
 7088       
 7089       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_NAS.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_NAS.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_NAS has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7090       QUIT;
 7091       
 7092       PROC SQL;
 7093          CREATE TABLE WORK.qryGetCustDispByRefNot0_NAS AS
 7094          SELECT t1.CODE AS REFERRED_TO,
 7095                 t1.DISPATCHED AS CUST_DISPATCHED,
 7096                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 7097             FROM WORK.TRNSTRANSPOSEDCUSTS1_NAS t1
 7098             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_NAS created, with 1 rows and 3 columns.
 
 7099       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7100       
 7101       PROC SQL;
 7102       CREATE TABLE WORK.AppendCustAndSurvey_NAS AS
 7103       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_NAS
 7104        OUTER UNION CORR
 7105       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_NAS
 7106       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_NAS created, with 1 rows and 3 columns.
 
 7107       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7108       
 7109       PROC SQL;
 7110          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_NAS AS
 7111          SELECT
 7112            ('5 - NASSAU') AS DIVISION,
 7113            t4.REFERRED_TO,
 7114                 t1.CUST_DISPATCHED,
 7115                 t1.CUST_NOT_DISPATCHED,
 7116                 t4.JOBS_DISPATCHED,
 7117                 t4.JOBS_NOT_DISPATCHED,
 7118                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 7119                 t3.ALL_JOBS_OUT AS ALL_JOBS
 7120             FROM WORK.QRYALLJOBSCUSTBYREFGRP_NAS t3, WORK.APPENDJOBSANDSURVEY_NAS t4, WORK.APPENDCUSTANDSURVEY_NAS t1
 7121             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_NAS created, with 1 rows and 8 columns.
 
 7122       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7123       
 7124       /* ************************************************************** NAS
 7124     ! ************************************************************** */
 7125       
 7126       /* ************************************************************** SUF
 7126     ! ************************************************************** */
 7127       
 7128       PROC SQL;
 7129          CREATE TABLE WORK.qryAllJobsCustByRefGrp_SUF AS
 7130          SELECT /* REFERRED_TO */
 7131                   (CASE
 7132                     WHEN t1.REFERRED_TO IS NULL
 7133                       THEN 'OPS'
 7134                        ELSE t1.REFERRED_TO
 7135                   END) AS REFERRED_TO,
 7136                 /* ALL_CUST_OUT */
 7137                   (SUM(t1.TTL_CUST_OUT)) AS ALL_CUST_OUT,
 7138                 /* ALL_JOBS_OUT */
 7139                   (COUNT(t1.CREATION_DATETIME)) AS ALL_JOBS_OUT
 7140             FROM WORK.QRYSTORM_FMT_DATES t1
 7141             WHERE t1.CALL_TYPE IN ('OUT') AND (t1.ENERGT IS NULL OR t1.ENERGT IS MISSING) AND t1.TTL_CUST_OUT > 0 AND
 7141     ! t1.DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 7142             GROUP BY (CALCULATED REFERRED_TO);
 NOTE: Table WORK.QRYALLJOBSCUSTBYREFGRP_SUF created, with 1 rows and 3 columns.
 
 7143       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7144       
 7145       proc sql;
 7146          create table WORK.TBLREFGROUPS_SUF
 7147          (
 7148       CODE char(12),
 7149               DESC char(50),
 7150               JOB_STATUS char(20)
 7151          );
 NOTE: Table WORK.TBLREFGROUPS_SUF created, with 0 rows and 3 columns.
 7152       
 7153       insert into WORK.TBLREFGROUPS_SUF
 7154       
 7155       VALUES('AMI','AMI','DISPATCHED')
 7156       VALUES('AMI','AMI','NOT_DISPATCHED')
 7157       VALUES('CBK','REFER TO CALLBACK','DISPATCHED')
 7158       VALUES('CBK','REFER TO CALLBACK','NOT_DISPATCHED')
 7159       VALUES('COL','REFER TO COLLECTIONS','DISPATCHED')
 7160       VALUES('COL','REFER TO COLLECTIONS','NOT_DISPATCHED')
 7161       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','DISPATCHED')
 7162       VALUES('CON','STORM OH/UG LINES (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7163       VALUES('D2D','REFER TO DUSK TO DAWN','DISPATCHED')
 7164       VALUES('D2D','REFER TO DUSK TO DAWN','NOT_DISPATCHED')
 7165       VALUES('ENV','ENVIRONMENTAL','DISPATCHED')
 7166       VALUES('ENV','ENVIRONMENTAL','NOT_DISPATCHED')
 7167       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','DISPATCHED')
 7168       VALUES('FLD','STORM FLOOD REST TASK FORCE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7169       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','DISPATCHED')
 7170       VALUES('LKP','STORM LOOK-UP/ SURVEY (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7171       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','DISPATCHED')
 7172       VALUES('MA1','STORM MUTUAL AID 1 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7173       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','DISPATCHED')
 7174       VALUES('MA10','STORM MUTUAL AID 10 (MAJOR STORM)','NOT_DISPATCHED')
 7175       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','DISPATCHED')
 7176       VALUES('MA11','STORM MUTUAL AID 11 (MAJOR STORM)','NOT_DISPATCHED')
 7177       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','DISPATCHED')
 7178       VALUES('MA12','STORM MUTUAL AID 12 (MAJOR STORM)','NOT_DISPATCHED')
 7179       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','DISPATCHED')
 7180       VALUES('MA13','STORM MUTUAL AID 13 (MAJOR STORM)','NOT_DISPATCHED')
 7181       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','DISPATCHED')
 7182       VALUES('MA14','STORM MUTUAL AID 14 (MAJOR STORM)','NOT_DISPATCHED')
 7183       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','DISPATCHED')
 7184       VALUES('MA15','STORM MUTUAL AID 15 (MAJOR STORM)','NOT_DISPATCHED')
 7185       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','DISPATCHED')
 7186       VALUES('MA16','STORM MUTUAL AID 16 (MAJOR STORM)','NOT_DISPATCHED')
 7187       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','DISPATCHED')
 7188       VALUES('MA17','STORM MUTUAL AID 17 (MAJOR STORM)','NOT_DISPATCHED')
 7189       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','DISPATCHED')
 7190       VALUES('MA18','STORM MUTUAL AID 18 (MAJOR STORM)','NOT_DISPATCHED')
 7191       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','DISPATCHED')
 7192       VALUES('MA19','STORM MUTUAL AID 19 (MAJOR STORM)','NOT_DISPATCHED')
 7193       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','DISPATCHED')
 7194       VALUES('MA2','STORM MUTUAL AID 2 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7195       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','DISPATCHED')
 7196       VALUES('MA20','STORM MUTUAL AID 20 (MAJOR STORM)','NOT_DISPATCHED')
 7197       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','DISPATCHED')
 7198       VALUES('MA21','STORM MUTUAL AID 21 (MAJOR STORM)','NOT_DISPATCHED')
 7199       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','DISPATCHED')
 7200       VALUES('MA22','STORM MUTUAL AID 22 (MAJOR STORM)','NOT_DISPATCHED')
 7201       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','DISPATCHED')
 7202       VALUES('MA23','STORM MUTUAL AID 23 (MAJOR STORM)','NOT_DISPATCHED')
 7203       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','DISPATCHED')
 7204       VALUES('MA24','STORM MUTUAL AID 24 (MAJOR STORM)','NOT_DISPATCHED')
 7205       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','DISPATCHED')
 7206       VALUES('MA25','STORM MUTUAL AID 25 (MAJOR STORM)','NOT_DISPATCHED')
 7207       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','DISPATCHED')
 7208       VALUES('MA26','STORM MUTUAL AID 26 (MAJOR STORM)','NOT_DISPATCHED')
 7209       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','DISPATCHED')
 7210       VALUES('MA27','STORM MUTUAL AID 27 (MAJOR STORM)','NOT_DISPATCHED')
 7211       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','DISPATCHED')
 7212       VALUES('MA28','STORM MUTUAL AID 28 (MAJOR STORM)','NOT_DISPATCHED')
 7213       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','DISPATCHED')
 7214       VALUES('MA29','STORM MUTUAL AID 29 (MAJOR STORM)','NOT_DISPATCHED')
 7215       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','DISPATCHED')
 7216       VALUES('MA3','STORM MUTUAL AID 3 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7217       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','DISPATCHED')
 7218       VALUES('MA30','STORM MUTUAL AID 30 (MAJOR STORM)','NOT_DISPATCHED')
 7219       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','DISPATCHED')
 7220       VALUES('MA31','STORM MUTUAL AID 31 (MAJOR STORM)','NOT_DISPATCHED')
 7221       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','DISPATCHED')
 7222       VALUES('MA32','STORM MUTUAL AID 32 (MAJOR STORM)','NOT_DISPATCHED')
 7223       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','DISPATCHED')
 7224       VALUES('MA33','STORM MUTUAL AID 33 (MAJOR STORM)','NOT_DISPATCHED')
 7225       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','DISPATCHED')
 7226       VALUES('MA34','STORM MUTUAL AID 34 (MAJOR STORM)','NOT_DISPATCHED')
 7227       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','DISPATCHED')
 7228       VALUES('MA35','STORM MUTUAL AID 35 (MAJOR STORM)','NOT_DISPATCHED')
 7229       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','DISPATCHED')
 7230       VALUES('MA36','STORM MUTUAL AID 36 (MAJOR STORM)','NOT_DISPATCHED')
 7231       VALUES('MA37','SRO1','DISPATCHED')
 7232       VALUES('MA37','SRO1','NOT_DISPATCHED')
 7233       VALUES('MA38','SRO2','DISPATCHED')
 7234       VALUES('MA38','SRO2','NOT_DISPATCHED')
 7235       VALUES('MA39','SRO3','DISPATCHED')
 7236       VALUES('MA39','SRO3','NOT_DISPATCHED')
 7237       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','DISPATCHED')
 7238       VALUES('MA4','STORM MUTUAL AID 4 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7239       VALUES('MA40','SRO4','DISPATCHED')
 7240       VALUES('MA40','SRO4','NOT_DISPATCHED')
 7241       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','DISPATCHED')
 7242       VALUES('MA5','STORM MUTUAL AID 5 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7243       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','DISPATCHED')
 7244       VALUES('MA6','STORM MUTUAL AID 6 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7245       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','DISPATCHED')
 7246       VALUES('MA7','STORM MUTUAL AID 7 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7247       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','DISPATCHED')
 7248       VALUES('MA8','STORM MUTUAL AID 8 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7249       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','DISPATCHED')
 7250       VALUES('MA9','STORM MUTUAL AID 9 (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7251       VALUES('MAP','REFER TO MAPPING','DISPATCHED')
 7252       VALUES('MAP','REFER TO MAPPING','NOT_DISPATCHED')
 7253       VALUES('OHT','REFER TO OH LINES AND TREES','DISPATCHED')
 7254       VALUES('OHT','REFER TO OH LINES AND TREES','NOT_DISPATCHED')
 7255       VALUES('OPS','OPERATIONS-ESD','DISPATCHED')
 7256       VALUES('OPS','OPERATIONS-ESD','NOT_DISPATCHED')
 7257       VALUES('PAT','PATROL-SST PLANNERS','DISPATCHED')
 7258       VALUES('PAT','PATROL-SST PLANNERS','NOT_DISPATCHED')
 7259       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','DISPATCHED')
 7260       VALUES('PRC','STORM PRIMARY CONTROL (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7261       VALUES('PRE','REFER TO PRECHECK','DISPATCHED')
 7262       VALUES('PRE','REFER TO PRECHECK','NOT_DISPATCHED')
 7263       VALUES('RAD','REFER TO RADIO','DISPATCHED')
 7264       VALUES('RAD','REFER TO RADIO','NOT_DISPATCHED')
 7265       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','DISPATCHED')
 7266       VALUES('RDC','STORM ROAD DEBRIS CLRNG (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7267       VALUES('REV','REFER TO REVENUE PROTECTION','DISPATCHED')
 7268       VALUES('REV','REFER TO REVENUE PROTECTION','NOT_DISPATCHED')
 7269       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','DISPATCHED')
 7270       VALUES('RFC','REFER TO CUST ORDER FULFILLMENT','NOT_DISPATCHED')
 7271       VALUES('RFI','REFER TO INSP-DESIGN','DISPATCHED')
 7272       VALUES('RFI','REFER TO INSP-DESIGN','NOT_DISPATCHED')
 7273       VALUES('RFM','REFER TO METER-MTS','DISPATCHED')
 7274       VALUES('RFM','REFER TO METER-MTS','NOT_DISPATCHED')
 7275       VALUES('RFO','REFER TO OH LINES','DISPATCHED')
 7276       VALUES('RFO','REFER TO OH LINES','NOT_DISPATCHED')
 7277       VALUES('RFS','REFER TO SPT','DISPATCHED')
 7278       VALUES('RFS','REFER TO SPT','NOT_DISPATCHED')
 7279       VALUES('RFT','REFER TO TREES-TREE TRIM','DISPATCHED')
 7280       VALUES('RFT','REFER TO TREES-TREE TRIM','NOT_DISPATCHED')
 7281       VALUES('RFU','REFER TO UG LINES','DISPATCHED')
 7282       VALUES('RFU','REFER TO UG LINES','NOT_DISPATCHED')
 7283       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','DISPATCHED')
 7284       VALUES('SSM','STORM SSM (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7285       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','DISPATCHED')
 7286       VALUES('STR','STORM TREE (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7287       VALUES('SUB','REFER TO SUBSTATION-SSM','DISPATCHED')
 7288       VALUES('SUB','REFER TO SUBSTATION-SSM','NOT_DISPATCHED')
 7289       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','DISPATCHED')
 7290       VALUES('SVC','STORM SEC/SVC REST WORK LV (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7291       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','DISPATCHED')
 7292       VALUES('SWW','STORM WIRE WATCHER (MAJOR STORM ONLY)','NOT_DISPATCHED')
 7293       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','DISPATCHED')
 7294       VALUES('TVI','RADIO AND TV INTERFERENCE GRP','NOT_DISPATCHED');
 NOTE: 140 rows were inserted into WORK.TBLREFGROUPS_SUF.
 
 7295       
 7296       quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7297       
 7298       PROC SQL;
 7299       CREATE TABLE WORK.GETJOBSDISPBYREFER_SUF
 7300       AS
 7301       (
 7302       SELECT
 7303       MAIN.CODE
 7304       ,MAIN.JOB_STATUS
 7305       ,SUM(TTL_JOBS) AS TTL_JOBS
 7306       FROM
 7307       (
 7308       SELECT
 7309         MAIN.CODE
 7310         ,MAIN.JOB_STATUS
 7311         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 7312       FROM
 7313       (
 7314       SELECT
 7315       CODE
 7316       ,JOB_STATUS
 7317       FROM WORK.TBLREFGROUPS_SUF
 7318       ) MAIN
 7319       
 7320       LEFT OUTER JOIN
 7321       (
 7322           SELECT
 7323             CASE
 7324               WHEN REFERRED_TO IS NULL
 7325               THEN
 7326                 'OPS'
 7327               ELSE
 7328                 REFERRED_TO
 7329             END AS REFERRED_TO
 7330             ,'DISPATCHED' AS JOB_STATUS
 7331             ,CASE
 7332               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 7333                 THEN COUNT(REFERRED_TO)
 7334                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 7335             END AS TTL_JOBS
 7336       
 7337           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7338           WHERE JOB_STATUS IN ('DISPATCHED') AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 7338     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 7339           GROUP BY REFERRED_TO, JOB_STATUS
 7340       
 7341           UNION
 7342       
 7343           SELECT
 7344             CASE
 7345               WHEN REFERRED_TO IS NULL
 7346               THEN
 7347                 'OPS'
 7348               ELSE
 7349                 REFERRED_TO
 7350             END AS REFERRED_TO
 7351             ,'NOT_DISPATCHED' AS JOB_STATUS
 7352             ,CASE
 7353               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 7354                 THEN COUNT(REFERRED_TO)
 7355                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 7356             END AS TTL_JOBS
 7357       
 7358           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7359           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND UPCASE(REFERRED_TO) NOT IN ('PRE', 'LKP') AND CALL_TYPE IN ('OUT') AND
 7359     ! TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 7360           GROUP BY REFERRED_TO, JOB_STATUS
 7361       )SUB
 7362       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 7363       )
 7364       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 7365       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 7366       );
 NOTE: Table WORK.GETJOBSDISPBYREFER_SUF created, with 136 rows and 3 columns.
 
 7367       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 7368       
 7369       PROC SQL;
 7370       CREATE VIEW WORK.SORTTempTableSorted_SUF AS
 7371       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 7372       FROM WORK.GETJOBSDISPBYREFER_SUF as T
 7373       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_SUF has been defined.
 7374       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7375       
 7376       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_SUF
 7377       OUT=WORK.TRNSTRANSPOSEDJOBS1_SUF(LABEL="Transposed WORK.GETJOBSDISPBYREFER")
 7378       NAME=Source
 7379       LABEL=Label
 7380       ;
 7381       BY CODE;
 7382       ID JOB_STATUS;
 7383       VAR TTL_JOBS;
 7384       
 7385       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETJOBSDISPBYREFER_SUF.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_SUF.
 NOTE: The data set WORK.TRNSTRANSPOSEDJOBS1_SUF has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7386       QUIT;
 7387       
 7388       PROC SQL;
 7389          CREATE TABLE WORK.qryGetJobsDispByRefNot0_SUF AS
 7390          SELECT t1.CODE AS REFERRED_TO,
 7391                 t1.DISPATCHED AS JOBS_DISPATCHED,
 7392                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 7393             FROM WORK.TRNSTRANSPOSEDJOBS1_SUF t1
 7394             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETJOBSDISPBYREFNOT0_SUF created, with 1 rows and 3 columns.
 
 7395       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7396       
 7397       PROC SQL;
 7398       CREATE TABLE GETJOBSSURVEY2_SUF
 7399       AS
 7400       (
 7401       SELECT
 7402       MAIN.CODE
 7403       ,MAIN.JOB_STATUS
 7404       ,SUM(TTL_JOBS) AS TTL_JOBS
 7405       FROM
 7406       (
 7407       SELECT
 7408         MAIN.CODE
 7409         ,MAIN.JOB_STATUS
 7410         ,COALESCE(SUB.TTL_JOBS,0) AS TTL_JOBS
 7411       FROM
 7412       (
 7413       SELECT
 7414       CODE
 7415       ,JOB_STATUS
 7416       FROM WORK.TBLREFGROUPS_SUF
 7417       ) MAIN
 7418       
 7419       LEFT OUTER JOIN
 7420       (
 7421           SELECT
 7422             CASE
 7423               WHEN REFERRED_TO IS NULL
 7424               THEN
 7425                 'OPS'
 7426               ELSE
 7427                 REFERRED_TO
 7428             END AS REFERRED_TO
 7429             ,'DISPATCHED' AS JOB_STATUS
 7430             ,CASE
 7431               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 7432                 THEN COUNT(REFERRED_TO)
 7433                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 7434             END AS TTL_JOBS
 7435       
 7436           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7437           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 7437     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3
 7437     ! - Western, Suf.', '4 - Eastern, Suf.')
 7438           GROUP BY REFERRED_TO, JOB_STATUS
 7439       
 7440           UNION
 7441       
 7442           SELECT
 7443             CASE
 7444               WHEN REFERRED_TO IS NULL
 7445               THEN
 7446                 'OPS'
 7447               ELSE
 7448                 REFERRED_TO
 7449             END AS REFERRED_TO
 7450             ,'NOT_DISPATCHED' AS JOB_STATUS
 7451             ,CASE
 7452               WHEN COUNT(*) - COUNT(REFERRED_TO) = 0
 7453                 THEN COUNT(REFERRED_TO)
 7454                 ELSE COUNT(*) - COUNT(REFERRED_TO)
 7455             END AS TTL_JOBS
 7456       
 7457           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7458           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 7458     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.', '4 -
 7458     ! Eastern, Suf.')
 7459           GROUP BY REFERRED_TO, JOB_STATUS
 7460       )SUB
 7461       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 7462       )
 7463       WHERE MAIN.CODE IN ('PRE', 'LKP')
 7464       GROUP BY MAIN.CODE, MAIN.JOB_STATUS
 7465       );
 NOTE: Table WORK.GETJOBSSURVEY2_SUF created, with 4 rows and 3 columns.
 
 7466       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 7467       
 7468       PROC SQL;
 7469       CREATE VIEW WORK.SORTTempTableSorted_SUF AS
 7470       SELECT T.TTL_JOBS, T.JOB_STATUS, T.CODE
 7471       FROM WORK.GETJOBSSURVEY2_SUF as T
 7472       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_SUF has been defined.
 7473       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7474       
 7475       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_SUF
 7476       OUT=WORK.TRNSTRANSPOSEDSURVJOBS1_SUF(LABEL="Transposed WORK.GETJOBSSURVEY2")
 7477       NAME=Source
 7478       LABEL=Label
 7479       ;
 7480       BY CODE;
 7481       ID JOB_STATUS;
 7482       VAR TTL_JOBS;
 7483       
 7484       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETJOBSSURVEY2_SUF.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_SUF.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVJOBS1_SUF has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7485       QUIT;
 7486       
 7487       PROC SQL;
 7488          CREATE TABLE WORK.qryGetSurvJobsDispByRefNot0_SUF AS
 7489          SELECT t1.CODE AS REFERRED_TO,
 7490                 t1.DISPATCHED AS JOBS_DISPATCHED,
 7491                 t1.NOT_DISPATCHED AS JOBS_NOT_DISPATCHED
 7492             FROM WORK.TRNSTRANSPOSEDSURVJOBS1_SUF t1
 7493             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVJOBSDISPBYREFNOT0_SUF created, with 0 rows and 3 columns.
 
 7494       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7495       
 7496       PROC SQL;
 7497       CREATE TABLE WORK.AppendJobsAndSurvey_SUF AS
 7498       SELECT * FROM WORK.QRYGETJOBSDISPBYREFNOT0_SUF
 7499        OUTER UNION CORR
 7500       SELECT * FROM WORK.QRYGETSURVJOBSDISPBYREFNOT0_SUF
 7501       ;
 NOTE: Table WORK.APPENDJOBSANDSURVEY_SUF created, with 1 rows and 3 columns.
 
 7502       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7503       
 7504       PROC SQL;
 7505       CREATE TABLE WORK.GETCUSTSURVEY2_SUF
 7506       AS
 7507       (
 7508       SELECT
 7509       MAIN.CODE
 7510       ,MAIN.JOB_STATUS
 7511       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7512       FROM
 7513       (
 7514       SELECT
 7515         MAIN.CODE
 7516         ,MAIN.JOB_STATUS
 7517         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 7518       FROM
 7519       (
 7520       SELECT
 7521       CODE
 7522       ,JOB_STATUS
 7523       FROM WORK.TBLREFGROUPS_SUF
 7524       ) MAIN
 7525       
 7526       LEFT OUTER JOIN
 7527       (
 7528           SELECT
 7529             CASE
 7530               WHEN REFERRED_TO IS NULL
 7531               THEN
 7532                 'OPS'
 7533               ELSE
 7534                 REFERRED_TO
 7535             END AS REFERRED_TO
 7536             ,'DISPATCHED' AS JOB_STATUS
 7537             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7538       
 7539           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7540           WHERE JOB_STATUS IN ('SURVEY') AND UPCASE(CREW_STATUS) IN ('DISPATCHED', 'ACCEPTED', 'EN ROUTE', 'ON SITE',
 7540     ! 'REPORTING') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3
 7540     ! - Western, Suf.', '4 - Eastern, Suf.')
 7541           GROUP BY REFERRED_TO, JOB_STATUS
 7542       
 7543           UNION
 7544       
 7545           SELECT
 7546             CASE
 7547               WHEN REFERRED_TO IS NULL
 7548               THEN
 7549                 'OPS'
 7550               ELSE
 7551                 REFERRED_TO
 7552             END AS REFERRED_TO
 7553             ,'NOT_DISPATCHED' AS JOB_STATUS
 7554             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7555       
 7556           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7557           WHERE JOB_STATUS = 'SURVEY' AND UPCASE(CREW_STATUS) IN ('CLEARED', 'RECEIVED', 'UNASSIGNED', '') AND CALL_TYPE IN
 7557     ! ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS MISSING) AND DISTRICT IN ('3 - Western, Suf.', '4 -
 7557     ! Eastern, Suf.')
 7558           GROUP BY REFERRED_TO, JOB_STATUS
 7559       )SUB
 7560       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 7561       )
 7562       WHERE MAIN.CODE IN ('PRE', 'LKP')
 7563       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 7564       );
 NOTE: Table WORK.GETCUSTSURVEY2_SUF created, with 4 rows and 3 columns.
 
 7565       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 7566       
 7567       PROC SQL;
 7568       CREATE VIEW WORK.SORTTempTableSorted_SUF AS
 7569       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 7570       FROM WORK.GETCUSTSURVEY2_SUF as T
 7571       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_SUF has been defined.
 7572       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7573       
 7574       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_SUF
 7575       OUT=WORK.TRNSTRANSPOSEDSURVCUST1_SUF(LABEL="Transposed WORK.GETCUSTSURVEY2")
 7576       NAME=Source
 7577       LABEL=Label
 7578       ;
 7579       BY CODE;
 7580       ID JOB_STATUS;
 7581       VAR TTL_CUST_OUT;
 7582       
 7583       RUN;
 
 NOTE: There were 4 observations read from the data set WORK.GETCUSTSURVEY2_SUF.
 NOTE: There were 4 observations read from the data set WORK.SORTTEMPTABLESORTED_SUF.
 NOTE: The data set WORK.TRNSTRANSPOSEDSURVCUST1_SUF has 2 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7584       QUIT;
 7585       
 7586       PROC SQL;
 7587          CREATE TABLE WORK.qryGetSurvCustDispByRefNot0_SUF AS
 7588          SELECT t1.CODE AS REFERRED_TO,
 7589                 t1.DISPATCHED AS CUST_DISPATCHED,
 7590                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 7591             FROM WORK.TRNSTRANSPOSEDSURVCUST1_SUF t1
 7592             WHERE t1.DISPATCHED > 0 OR t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETSURVCUSTDISPBYREFNOT0_SUF created, with 0 rows and 3 columns.
 
 7593       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 7594       
 7595       PROC SQL;
 7596       CREATE TABLE WORK.GETCUSTDISPBYREFER_SUF
 7597       AS
 7598       (
 7599       SELECT
 7600       MAIN.CODE
 7601       ,MAIN.JOB_STATUS
 7602       ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7603       FROM
 7604       (
 7605       SELECT
 7606         MAIN.CODE
 7607         ,MAIN.JOB_STATUS
 7608         ,COALESCE(SUB.TTL_CUST_OUT,0) AS TTL_CUST_OUT
 7609       FROM
 7610       (
 7611       SELECT
 7612       CODE
 7613       ,JOB_STATUS
 7614       FROM WORK.TBLREFGROUPS_SUF
 7615       ) MAIN
 7616       
 7617       LEFT OUTER JOIN
 7618       (
 7619           SELECT
 7620             CASE
 7621               WHEN REFERRED_TO IS NULL
 7622               THEN
 7623                 'OPS'
 7624               ELSE
 7625                 REFERRED_TO
 7626             END AS REFERRED_TO
 7627             ,'DISPATCHED' AS JOB_STATUS
 7628             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7629       
 7630           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7631           WHERE JOB_STATUS IN ('DISPATCHED') AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 7631     ! MISSING) AND DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 7632           GROUP BY REFERRED_TO, JOB_STATUS
 7633       
 7634           UNION
 7635       
 7636           SELECT
 7637             CASE
 7638               WHEN REFERRED_TO IS NULL
 7639               THEN
 7640                 'OPS'
 7641               ELSE
 7642                 REFERRED_TO
 7643             END AS REFERRED_TO
 7644             ,'NOT_DISPATCHED' AS JOB_STATUS
 7645             ,SUM(TTL_CUST_OUT) AS TTL_CUST_OUT
 7646       
 7647           FROM WORK.V_ETR_SUMMARY_BASELINE_STORM
 7648           WHERE JOB_STATUS = 'NOT_DISPATCHED' AND CALL_TYPE IN ('OUT') AND TTL_CUST_OUT > 0 AND (ENERGT IS NULL OR ENERGT IS
 7648     ! MISSING) AND DISTRICT IN ('3 - Western, Suf.', '4 - Eastern, Suf.')
 7649           GROUP BY REFERRED_TO, JOB_STATUS
 7650       )SUB
 7651       ON MAIN.CODE = SUB.REFERRED_TO AND MAIN.Job_Status = SUB.Job_Status
 7652       )
 7653       WHERE MAIN.CODE NOT IN ('PRE', 'LKP')
 7654       GROUP BY MAIN.CODE,MAIN.JOB_STATUS
 7655       );
 NOTE: Table WORK.GETCUSTDISPBYREFER_SUF created, with 136 rows and 3 columns.
 
 7656       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 7657       
 7658       PROC SQL;
 7659       CREATE VIEW WORK.SORTTempTableSorted_SUF AS
 7660       SELECT T.TTL_CUST_OUT, T.JOB_STATUS, T.CODE
 7661       FROM WORK.GETCUSTDISPBYREFER_SUF as T
 7662       ;
 NOTE: SQL view WORK.SORTTEMPTABLESORTED_SUF has been defined.
 7663       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7664       
 7665       PROC TRANSPOSE DATA=WORK.SORTTempTableSorted_SUF
 7666       OUT=WORK.TRNSTRANSPOSEDCUSTS1_SUF(LABEL="Transposed WORK.GETCUSTDISPBYREFER")
 7667       NAME=Source
 7668       LABEL=Label
 7669       ;
 7670       BY CODE;
 7671       ID JOB_STATUS;
 7672       VAR TTL_CUST_OUT;
 7673       
 7674       RUN;
 
 NOTE: There were 136 observations read from the data set WORK.GETCUSTDISPBYREFER_SUF.
 NOTE: There were 136 observations read from the data set WORK.SORTTEMPTABLESORTED_SUF.
 NOTE: The data set WORK.TRNSTRANSPOSEDCUSTS1_SUF has 68 observations and 4 variables.
 NOTE: PROCEDURE TRANSPOSE used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 7675       QUIT;
 7676       
 7677       PROC SQL;
 7678          CREATE TABLE WORK.qryGetCustDispByRefNot0_SUF AS
 7679          SELECT t1.CODE AS REFERRED_TO,
 7680                 t1.DISPATCHED AS CUST_DISPATCHED,
 7681                 t1.NOT_DISPATCHED AS CUST_NOT_DISPATCHED
 7682             FROM WORK.TRNSTRANSPOSEDCUSTS1_SUF t1
 7683             WHERE t1.DISPATCHED > 0 or t1.NOT_DISPATCHED > 0;
 NOTE: Table WORK.QRYGETCUSTDISPBYREFNOT0_SUF created, with 1 rows and 3 columns.
 
 7684       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7685       
 7686       PROC SQL;
 7687       CREATE TABLE WORK.AppendCustAndSurvey_SUF AS
 7688       SELECT * FROM WORK.QRYGETCUSTDISPBYREFNOT0_SUF
 7689        OUTER UNION CORR
 7690       SELECT * FROM WORK.QRYGETSURVCUSTDISPBYREFNOT0_SUF
 7691       ;
 NOTE: Table WORK.APPENDCUSTANDSURVEY_SUF created, with 1 rows and 3 columns.
 
 7692       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7693       
 7694       PROC SQL;
 7695          CREATE TABLE WORK.QV_JobsCustDispatchByRef1_SUF AS
 7696          SELECT
 7697            ('6 - SUFFOLK') AS DIVISION,
 7698            t4.REFERRED_TO,
 7699                 t1.CUST_DISPATCHED,
 7700                 t1.CUST_NOT_DISPATCHED,
 7701                 t4.JOBS_DISPATCHED,
 7702                 t4.JOBS_NOT_DISPATCHED,
 7703                 t3.ALL_CUST_OUT AS ALL_CUSTOMERS,
 7704                 t3.ALL_JOBS_OUT AS ALL_JOBS
 7705             FROM WORK.QRYALLJOBSCUSTBYREFGRP_SUF t3, WORK.APPENDJOBSANDSURVEY_SUF t4, WORK.APPENDCUSTANDSURVEY_SUF t1
 7706             WHERE (t3.REFERRED_TO = t4.REFERRED_TO AND t3.REFERRED_TO = t1.REFERRED_TO);
 NOTE: Table WORK.QV_JOBSCUSTDISPATCHBYREF1_SUF created, with 1 rows and 8 columns.
 
 7707       QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.02 seconds
       
 
 7708       
 7709       /* ************************************************************** SUF
 7709     ! ************************************************************** */
 7710       
 7711       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 7712       
 7713       PROC SQL;
 7714       CREATE TABLE WORK.QV_JobsCustDispByRef55 AS
 7715       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_ALL
 7716        OUTER UNION CORR
 7717       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_QN
 7718        OUTER UNION CORR
 7719       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_CN
 7720        OUTER UNION CORR
 7721       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_WS
 7722        OUTER UNION CORR
 7723       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_ES
 7724        OUTER UNION CORR
 7725       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_NAS
 7726        OUTER UNION CORR
 7727       SELECT * FROM WORK.QV_JobsCustDispatchByRef1_SUF
 7728       ORDER BY DIVISION ASC, REFERRED_TO ASC;
 NOTE: Table WORK.QV_JOBSCUSTDISPBYREF55 created, with 7 rows and 8 columns.
 
 7729       Quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 7730       
 7731       /* ********************************************** COMBINE ALL DIVS ********************************************** */
 7732       
 7733       /* ****************************************************** OUTAGES BY REF GROUP
 7733     ! ****************************************************** */
 7734       
 7735       
 7736       /*
 7737       %end;
 7738       
 7739       %mend;
 7740       
 7741       
 7742       %getHourlyTotals();
 7743       */
 7744       
 7745       /* ********************************************** LOAD QV_WTHRMULT_DASH ********************************************** */
 7746       
 7747       
 7748       /* ------
 7749       * Macro Inputs:
 7750       * IN_TABLE - table, with libname reference, to be copied.
 7751       * OUT_TABLE - name of the table to be created on LASR.
 7752       * ------ */
 7753       
 7754       
 7755       %macro load_to_lasr(in_table=WORK.QV_WTHRMULT_DASH, out_table=Q_WTHRMULT_DASH55);
 7756       
 7757        /* Connect to LASR Analytic Server */
 7758        libname esd_lasr sasiola
 7759        tag=vaesd
 7760        port=10034
 7761        host="pl-dr-sas-lasn1.psegliny.com"
 7762        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 7763       
 7764        /* Drop Physical Table - if exists */
 7765        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7766        proc sql noprint;
 7767        drop table esd_lasr.&out_table;
 7768        quit;
 7769        %end;
 7770       
 7771        /* Drop Table Metadata - if exists */
 7772        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 7772     ! ;
 7773        proc metalib;
 7774        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7775        repname="Foundation"
 7776        );
 7777        select = ("&out_table");
 7778        update_rule = (delete);
 7779        run;
 7780        %end;
 7781       
 7782        /* Load Table to LASR Analytic Server */
 7783        data esd_lasr.&out_table;
 7784        set &in_table;
 7785        run;
 7786       
 7787        /* Create Metadata for Table - if exists */
 7788        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7789        proc metalib;
 7790        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7791        repname="Foundation"
 7792        );
 7793        select ("&out_table");
 7794        run;
 7795        %end;
 7796        %else %do;
 7797        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 7798        %end;
 7799       
 7800       
 7801       %mend load_to_lasr;
 7802       
 7803       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_WTHRMULT_DASH55;
 NOTE: The table VAESD.Q_WTHRMULT_DASH55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_WTHRMULT_DASH55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.97 seconds
       cpu time            0.08 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_WTHRMULT_DASH55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.87 seconds
       cpu time            0.11 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_WTHRMULT_DASH55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_WTHRMULT_DASH;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 4 observations read from the data set WORK.QV_WTHRMULT_DASH.
 NOTE: The data set ESD_LASR.Q_WTHRMULT_DASH55 has 4 observations and 2 variables.

 NOTE: DATA statement used (Total process time):
       real time           4.04 seconds
       cpu time            0.25 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_WTHRMULT_DASH55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           9.58 seconds
       cpu time            0.32 seconds
       
 
 7804       
 7805       
 7806       /* ********************************************** LOAD QV_WTHRMULT_DASH ********************************************** */
 7807       
 7808       
 7809       /* ********************************************** LOAD QV_GLOBALETR_DASH **********************************************
 7809     ! */
 7810       
 7811       
 7812       /* ------
 7813       * Macro Inputs:
 7814       * IN_TABLE - table, with libname reference, to be copied.
 7815       * OUT_TABLE - name of the table to be created on LASR.
 7816       * ------ */
 7817       
 7818       
 7819       %macro load_to_lasr(in_table=WORK.QV_GLOBALETR_DASH, out_table=Q_GLOBALETR_DASH);
 7820       
 7821        /* Connect to LASR Analytic Server */
 7822        libname esd_lasr sasiola
 7823        tag=vaesd
 7824        port=10034
 7825        host="pl-dr-sas-lasn1.psegliny.com"
 7826        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 7827       
 7828        /* Drop Physical Table - if exists */
 7829        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7830        proc sql noprint;
 7831        drop table esd_lasr.&out_table;
 7832        quit;
 7833        %end;
 7834       
 7835        /* Drop Table Metadata - if exists */
 7836        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 7836     ! ;
 7837        proc metalib;
 7838        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7839        repname="Foundation"
 7840        );
 7841        select = ("&out_table");
 7842        update_rule = (delete);
 7843        run;
 7844        %end;
 7845       
 7846        /* Load Table to LASR Analytic Server */
 7847        data esd_lasr.&out_table;
 7848        set &in_table;
 7849        run;
 7850       
 7851        /* Create Metadata for Table - if exists */
 7852        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7853        proc metalib;
 7854        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7855        repname="Foundation"
 7856        );
 7857        select ("&out_table");
 7858        run;
 7859        %end;
 7860        %else %do;
 7861        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 7862        %end;
 7863       
 7864       
 7865       %mend load_to_lasr;
 7866       
 7867       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_GLOBALETR_DASH;

 NOTE: The table VAESD.Q_GLOBALETR_DASH has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_GLOBALETR_DASH has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.73 seconds
       cpu time            0.07 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_GLOBALETR_DASH");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.40 seconds
       cpu time            0.12 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_GLOBALETR_DASH;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_GLOBALETR_DASH;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 0 observations read from the data set WORK.QV_GLOBALETR_DASH.
 NOTE: The data set ESD_LASR.Q_GLOBALETR_DASH has 0 observations and 4 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.66 seconds
       cpu time            0.23 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_GLOBALETR_DASH");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           8.29 seconds
       cpu time            0.34 seconds
       
 
 7868       
 7869       
 7870       /* ********************************************** LOAD QV_GLOBALETR_DASH **********************************************
 7870     ! */
 7871       
 7872       
 7873       /* ********************************************** LOAD QV_APPEND_ALL_DIVS55
 7873     ! ********************************************** */
 7874       
 7875       
 7876       /* ------
 7877       * Macro Inputs:
 7878       * IN_TABLE - table, with libname reference, to be copied.
 7879       * OUT_TABLE - name of the table to be created on LASR.
 7880       * ------ */
 7881       
 7882       
 7883       %macro load_to_lasr(in_table=WORK.QV_APPEND_ALL_DIVS55, out_table=Q_HOURLY_TOTALS55);
 7884       
 7885        /* Connect to LASR Analytic Server */
 7886        libname esd_lasr sasiola
 7887        tag=vaesd
 7888        port=10034
 7889        host="pl-dr-sas-lasn1.psegliny.com"
 7890        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 7891       
 7892        /* Drop Physical Table - if exists */
 7893        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7894        proc sql noprint;
 7895        drop table esd_lasr.&out_table;
 7896        quit;
 7897        %end;
 7898       
 7899        /* Drop Table Metadata - if exists */
 7900        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 7900     ! ;
 7901        proc metalib;
 7902        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7903        repname="Foundation"
 7904        );
 7905        select = ("&out_table");
 7906        update_rule = (delete);
 7907        run;
 7908        %end;
 7909       
 7910        /* Load Table to LASR Analytic Server */
 7911        data esd_lasr.&out_table;
 7912        set &in_table;
 7913        run;
 7914       
 7915        /* Create Metadata for Table - if exists */
 7916        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7917        proc metalib;
 7918        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7919        repname="Foundation"
 7920        );
 7921        select ("&out_table");
 7922        run;
 7923        %end;
 7924        %else %do;
 7925        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 7926        %end;
 7927       
 7928       
 7929       %mend load_to_lasr;
 7930       
 7931       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_HOURLY_TOTALS55;

 NOTE: The table VAESD.Q_HOURLY_TOTALS55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_HOURLY_TOTALS55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.52 seconds
       cpu time            0.08 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_HOURLY_TOTALS55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.48 seconds
       cpu time            0.11 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_HOURLY_TOTALS55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_APPEND_ALL_DIVS55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 1743 observations read from the data set WORK.QV_APPEND_ALL_DIVS55.
 NOTE: The data set ESD_LASR.Q_HOURLY_TOTALS55 has 1743 observations and 13 variables.

 NOTE: DATA statement used (Total process time):
       real time           4.03 seconds
       cpu time            0.26 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_HOURLY_TOTALS55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           7.80 seconds
       cpu time            0.33 seconds
       
 
 7932       
 7933       /* ********************************************** LOAD QV_APPEND_ALL_DIVS55
 7933     ! ********************************************** */
 7934       
 7935       
 7936       /* ********************************************** LOAD QV_DispatchedVsNot55
 7936     ! ********************************************** */
 7937       
 7938       
 7939       /* ------
 7940       * Macro Inputs:
 7941       * IN_TABLE - table, with libname reference, to be copied.
 7942       * OUT_TABLE - name of the table to be created on LASR.
 7943       * ------ */
 7944       
 7945       
 7946       %macro load_to_lasr(in_table=WORK.QV_DispatchedVsNot55, out_table=Q_DispatchedVsNot55);
 7947       
 7948        /* Connect to LASR Analytic Server */
 7949        libname esd_lasr sasiola
 7950        tag=vaesd
 7951        port=10034
 7952        host="pl-dr-sas-lasn1.psegliny.com"
 7953        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 7954       
 7955        /* Drop Physical Table - if exists */
 7956        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7957        proc sql noprint;
 7958        drop table esd_lasr.&out_table;
 7959        quit;
 7960        %end;
 7961       
 7962        /* Drop Table Metadata - if exists */
 7963        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 7963     ! ;
 7964        proc metalib;
 7965        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7966        repname="Foundation"
 7967        );
 7968        select = ("&out_table");
 7969        update_rule = (delete);
 7970        run;
 7971        %end;
 7972       
 7973        /* Load Table to LASR Analytic Server */
 7974        data esd_lasr.&out_table;
 7975        set &in_table;
 7976        run;
 7977       
 7978        /* Create Metadata for Table - if exists */
 7979        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 7980        proc metalib;
 7981        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 7982        repname="Foundation"
 7983        );
 7984        select ("&out_table");
 7985        run;
 7986        %end;
 7987        %else %do;
 7988        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 7989        %end;
 7990       
 7991       
 7992       %mend load_to_lasr;
 7993       
 7994       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_DispatchedVsNot55;

 NOTE: The table VAESD.Q_DISPATCHEDVSNOT55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_DISPATCHEDVSNOT55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.38 seconds
       cpu time            0.09 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_DispatchedVsNot55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.40 seconds
       cpu time            0.12 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_DispatchedVsNot55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_DispatchedVsNot55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 11 observations read from the data set WORK.QV_DISPATCHEDVSNOT55.
 NOTE: The data set ESD_LASR.Q_DISPATCHEDVSNOT55 has 11 observations and 4 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.84 seconds
       cpu time            0.23 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_DispatchedVsNot55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           8.53 seconds
       cpu time            0.31 seconds
       
 
 7995       
 7996       
 7997       /* ********************************************** LOAD QV_DispatchedVsNot55
 7997     ! ********************************************** */
 7998       
 7999       
 8000       
 8001       /* ********************************************** LOAD QV_GETCUROUTBYVLG55 **********************************************
 8001     !  */
 8002       
 8003       
 8004       /* ------
 8005       * Macro Inputs:
 8006       * IN_TABLE - table, with libname reference, to be copied.
 8007       * OUT_TABLE - name of the table to be created on LASR.
 8008       * ------ */
 8009       
 8010       
 8011       %macro load_to_lasr(in_table=WORK.QV_GETCUROUTBYVLG55, out_table=Q_GETCUROUTBYVLG55);
 8012       
 8013        /* Connect to LASR Analytic Server */
 8014        libname esd_lasr sasiola
 8015        tag=vaesd
 8016        port=10034
 8017        host="pl-dr-sas-lasn1.psegliny.com"
 8018        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 8019       
 8020        /* Drop Physical Table - if exists */
 8021        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8022        proc sql noprint;
 8023        drop table esd_lasr.&out_table;
 8024        quit;
 8025        %end;
 8026       
 8027        /* Drop Table Metadata - if exists */
 8028        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 8028     ! ;
 8029        proc metalib;
 8030        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8031        repname="Foundation"
 8032        );
 8033        select = ("&out_table");
 8034        update_rule = (delete);
 8035        run;
 8036        %end;
 8037       
 8038        /* Load Table to LASR Analytic Server */
 8039        data esd_lasr.&out_table;
 8040        set &in_table;
 8041        run;
 8042       
 8043        /* Create Metadata for Table - if exists */
 8044        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8045        proc metalib;
 8046        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8047        repname="Foundation"
 8048        );
 8049        select ("&out_table");
 8050        run;
 8051        %end;
 8052        %else %do;
 8053        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 8054        %end;
 8055       
 8056       
 8057       %mend load_to_lasr;
 8058       
 8059       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_GETCUROUTBYVLG55;

 NOTE: The table VAESD.Q_GETCUROUTBYVLG55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_GETCUROUTBYVLG55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.14 seconds
       cpu time            0.09 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_GETCUROUTBYVLG55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.32 seconds
       cpu time            0.12 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_GETCUROUTBYVLG55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_GETCUROUTBYVLG55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 25 observations read from the data set WORK.QV_GETCUROUTBYVLG55.
 NOTE: The data set ESD_LASR.Q_GETCUROUTBYVLG55 has 25 observations and 4 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.52 seconds
       cpu time            0.20 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_GETCUROUTBYVLG55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           9.60 seconds
       cpu time            0.33 seconds
       
 
 8060       
 8061       
 8062       /* ********************************************** LOAD QV_GETCUROUTBYVLG55 **********************************************
 8062     !  */
 8063       
 8064       
 8065       
 8066       /* ********************************************** LOAD QV_GETLSECUSTOUT55 **********************************************
 8066     ! */
 8067       
 8068       
 8069       /* ------
 8070       * Macro Inputs:
 8071       * IN_TABLE - table, with libname reference, to be copied.
 8072       * OUT_TABLE - name of the table to be created on LASR.
 8073       * ------ */
 8074       
 8075       
 8076       %macro load_to_lasr(in_table=WORK.QV_GETLSECUSTOUT55, out_table=Q_GETLSECUSTOUT55);
 8077       
 8078        /* Connect to LASR Analytic Server */
 8079        libname esd_lasr sasiola
 8080        tag=vaesd
 8081        port=10034
 8082        host="pl-dr-sas-lasn1.psegliny.com"
 8083        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 8084       
 8085        /* Drop Physical Table - if exists */
 8086        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8087        proc sql noprint;
 8088        drop table esd_lasr.&out_table;
 8089        quit;
 8090        %end;
 8091       
 8092        /* Drop Table Metadata - if exists */
 8093        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 8093     ! ;
 8094        proc metalib;
 8095        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8096        repname="Foundation"
 8097        );
 8098        select = ("&out_table");
 8099        update_rule = (delete);
 8100        run;
 8101        %end;
 8102       
 8103        /* Load Table to LASR Analytic Server */
 8104        data esd_lasr.&out_table;
 8105        set &in_table;
 8106        run;
 8107       
 8108        /* Create Metadata for Table - if exists */
 8109        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8110        proc metalib;
 8111        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8112        repname="Foundation"
 8113        );
 8114        select ("&out_table");
 8115        run;
 8116        %end;
 8117        %else %do;
 8118        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 8119        %end;
 8120       
 8121       
 8122       %mend load_to_lasr;
 8123       
 8124       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_GETLSECUSTOUT55;

 NOTE: The table VAESD.Q_GETLSECUSTOUT55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_GETLSECUSTOUT55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.24 seconds
       cpu time            0.09 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_GETLSECUSTOUT55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.84 seconds
       cpu time            0.13 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_GETLSECUSTOUT55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_GETLSECUSTOUT55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 0 observations read from the data set WORK.QV_GETLSECUSTOUT55.
 NOTE: The data set ESD_LASR.Q_GETLSECUSTOUT55 has 0 observations and 6 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.71 seconds
       cpu time            0.22 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_GETLSECUSTOUT55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           7.70 seconds
       cpu time            0.30 seconds
       
 
 8125       
 8126       
 8127       /* ********************************************** LOAD QV_GETLSECUSTOUT55 **********************************************
 8127     ! */
 8128       
 8129       
 8130       
 8131       /* ********************************************** LOAD QV_GETLSECUSTOUT55 **********************************************
 8131     ! */
 8132       
 8133       
 8134       /* ------
 8135       * Macro Inputs:
 8136       * IN_TABLE - table, with libname reference, to be copied.
 8137       * OUT_TABLE - name of the table to be created on LASR.
 8138       * ------ */
 8139       
 8140       
 8141       %macro load_to_lasr(in_table=WORK.QV_GETCRITCUSTOUT55, out_table=Q_GETCRITCUSTOUT55);
 8142       
 8143        /* Connect to LASR Analytic Server */
 8144        libname esd_lasr sasiola
 8145        tag=vaesd
 8146        port=10034
 8147        host="pl-dr-sas-lasn1.psegliny.com"
 8148        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 8149       
 8150        /* Drop Physical Table - if exists */
 8151        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8152        proc sql noprint;
 8153        drop table esd_lasr.&out_table;
 8154        quit;
 8155        %end;
 8156       
 8157        /* Drop Table Metadata - if exists */
 8158        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 8158     ! ;
 8159        proc metalib;
 8160        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8161        repname="Foundation"
 8162        );
 8163        select = ("&out_table");
 8164        update_rule = (delete);
 8165        run;
 8166        %end;
 8167       
 8168        /* Load Table to LASR Analytic Server */
 8169        data esd_lasr.&out_table;
 8170        set &in_table;
 8171        run;
 8172       
 8173        /* Create Metadata for Table - if exists */
 8174        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8175        proc metalib;
 8176        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8177        repname="Foundation"
 8178        );
 8179        select ("&out_table");
 8180        run;
 8181        %end;
 8182        %else %do;
 8183        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 8184        %end;
 8185       
 8186       
 8187       %mend load_to_lasr;
 8188       
 8189       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_GETCRITCUSTOUT55;

 NOTE: The table VAESD.Q_GETCRITCUSTOUT55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_GETCRITCUSTOUT55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.37 seconds
       cpu time            0.08 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_GETCRITCUSTOUT55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.77 seconds
       cpu time            0.12 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_GETCRITCUSTOUT55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_GETCRITCUSTOUT55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 0 observations read from the data set WORK.QV_GETCRITCUSTOUT55.
 NOTE: The data set ESD_LASR.Q_GETCRITCUSTOUT55 has 0 observations and 6 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.41 seconds
       cpu time            0.22 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_GETCRITCUSTOUT55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           9.23 seconds
       cpu time            0.33 seconds
       
 
 8190       
 8191       
 8192       /* ********************************************** LOAD QV_GETLSECUSTOUT55 **********************************************
 8192     ! */
 8193       
 8194       /* ********************************************** LOAD QV_OutByTypeAllVsNot55
 8194     ! ********************************************** */
 8195       
 8196       
 8197       /* ------
 8198       * Macro Inputs:
 8199       * IN_TABLE - table, with libname reference, to be copied.
 8200       * OUT_TABLE - name of the table to be created on LASR.
 8201       * ------ */
 8202       
 8203       
 8204       %macro load_to_lasr(in_table=WORK.QV_OutByTypeAllVsNot55, out_table=Q_OutByTypeAllVsNot55);
 8205       
 8206        /* Connect to LASR Analytic Server */
 8207        libname esd_lasr sasiola
 8208        tag=vaesd
 8209        port=10034
 8210        host="pl-dr-sas-lasn1.psegliny.com"
 8211        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 8212       
 8213        /* Drop Physical Table - if exists */
 8214        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8215        proc sql noprint;
 8216        drop table esd_lasr.&out_table;
 8217        quit;
 8218        %end;
 8219       
 8220        /* Drop Table Metadata - if exists */
 8221        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 8221     ! ;
 8222        proc metalib;
 8223        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8224        repname="Foundation"
 8225        );
 8226        select = ("&out_table");
 8227        update_rule = (delete);
 8228        run;
 8229        %end;
 8230       
 8231        /* Load Table to LASR Analytic Server */
 8232        data esd_lasr.&out_table;
 8233        set &in_table;
 8234        run;
 8235       
 8236        /* Create Metadata for Table - if exists */
 8237        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8238        proc metalib;
 8239        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8240        repname="Foundation"
 8241        );
 8242        select ("&out_table");
 8243        run;
 8244        %end;
 8245        %else %do;
 8246        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 8247        %end;
 8248       
 8249       
 8250       %mend load_to_lasr;
 8251       
 8252       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_OutByTypeAllVsNot55;

 NOTE: The table VAESD.Q_OUTBYTYPEALLVSNOT55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_OUTBYTYPEALLVSNOT55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.47 seconds
       cpu time            0.08 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_OutByTypeAllVsNot55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.61 seconds
       cpu time            0.12 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_OutByTypeAllVsNot55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_OutByTypeAllVsNot55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 20 observations read from the data set WORK.QV_OUTBYTYPEALLVSNOT55.
 NOTE: The data set ESD_LASR.Q_OUTBYTYPEALLVSNOT55 has 20 observations and 6 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.82 seconds
       cpu time            0.22 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_OutByTypeAllVsNot55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           9.51 seconds
       cpu time            0.34 seconds
       
 
 8253       
 8254       
 8255       /* ********************************************** LOAD QV_OutByTypeAllVsNot55
 8255     ! ********************************************** */
 8256       
 8257       
 8258       /* ********************************************** LOAD QV_JobsCustDispByRef55
 8258     ! ********************************************** */
 8259       
 8260       
 8261       /* ------
 8262       * Macro Inputs:
 8263       * IN_TABLE - table, with libname reference, to be copied.
 8264       * OUT_TABLE - name of the table to be created on LASR.
 8265       * ------ */
 8266       
 8267       
 8268       %macro load_to_lasr(in_table=WORK.QV_JobsCustDispByRef55, out_table=Q_JobsCustDispByRef55);
 8269       
 8270        /* Connect to LASR Analytic Server */
 8271        libname esd_lasr sasiola
 8272        tag=vaesd
 8273        port=10034
 8274        host="pl-dr-sas-lasn1.psegliny.com"
 8275        signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 8276       
 8277        /* Drop Physical Table - if exists */
 8278        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8279        proc sql noprint;
 8280        drop table esd_lasr.&out_table;
 8281        quit;
 8282        %end;
 8283       
 8284        /* Drop Table Metadata - if exists */
 8285        %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do
 8285     ! ;
 8286        proc metalib;
 8287        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8288        repname="Foundation"
 8289        );
 8290        select = ("&out_table");
 8291        update_rule = (delete);
 8292        run;
 8293        %end;
 8294       
 8295        /* Load Table to LASR Analytic Server */
 8296        data esd_lasr.&out_table;
 8297        set &in_table;
 8298        run;
 8299       
 8300        /* Create Metadata for Table - if exists */
 8301        %if %sysfunc(exist(esd_lasr.&out_table)) %then %do;
 8302        proc metalib;
 8303        omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR"
 8304        repname="Foundation"
 8305        );
 8306        select ("&out_table");
 8307        run;
 8308        %end;
 8309        %else %do;
 8310        %put ERROR: Physical Table &out_table Does Not Exist - No Metadata Created.;
 8311        %end;
 8312       
 8313       
 8314       %mend load_to_lasr;
 8315       
 8316       %load_to_lasr;
 MPRINT(LOAD_TO_LASR):   libname esd_lasr sasiola tag=vaesd port=10034 host="pl-dr-sas-lasn1.psegliny.com" 
 signer="https://sasreporting2dr.psegliny.com:443/SASLASRAuthorization";
 NOTE: Libref ESD_LASR was successfully assigned as follows: 
       Engine:        SASIOLA 
       Physical Name: SAS LASR Analytic Server engine on host 'pl-dr-sas-lasn1.psegliny.com', port 10034
 MPRINT(LOAD_TO_LASR):   proc sql noprint;
 MPRINT(LOAD_TO_LASR):   drop table esd_lasr.Q_JobsCustDispByRef55;

 NOTE: The table VAESD.Q_JOBSCUSTDISPBYREF55 has been removed from the SAS LASR Analytic Server.

 NOTE: Table ESD_LASR.Q_JOBSCUSTDISPBYREF55 has been dropped.
 MPRINT(LOAD_TO_LASR):   quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           2.30 seconds
       cpu time            0.08 seconds
       
 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select = ("Q_JobsCustDispByRef55");
 MPRINT(LOAD_TO_LASR):   update_rule = (delete);
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was deleted.
 NOTE: Metadata for 0 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           2.47 seconds
       cpu time            0.10 seconds
       
 
 MPRINT(LOAD_TO_LASR):   data esd_lasr.Q_JobsCustDispByRef55;
 MPRINT(LOAD_TO_LASR):   set WORK.QV_JobsCustDispByRef55;
 MPRINT(LOAD_TO_LASR):   run;
 
 NOTE: There were 7 observations read from the data set WORK.QV_JOBSCUSTDISPBYREF55.
 NOTE: The data set ESD_LASR.Q_JOBSCUSTDISPBYREF55 has 7 observations and 8 variables.

 NOTE: DATA statement used (Total process time):
       real time           3.74 seconds
       cpu time            0.29 seconds
       

 
 MPRINT(LOAD_TO_LASR):   proc metalib;
 MPRINT(LOAD_TO_LASR):   omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" );
 MPRINT(LOAD_TO_LASR):   select ("Q_JobsCustDispByRef55");
 MPRINT(LOAD_TO_LASR):   run;
 

 NOTE: A total of 1 tables were analyzed for library "Visual Analytics ESD LASR".
 NOTE: Metadata for 0 tables was updated.
 NOTE: Metadata for 1 tables was added.
 NOTE: Metadata for 0 tables matched the data sources.
 NOTE: 0 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.
 NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 NOTE: PROCEDURE METALIB used (Total process time):
       real time           8.80 seconds
       cpu time            0.35 seconds
       
 
 8317       
 8318       
 8319       /* ********************************************** LOAD QV_JobsCustDispByRef55
 8319     ! ********************************************** */
 8320       
 8321       OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 8333       
SASKiwi
PROC Star

How long did this job take in actual time? Your LASR load steps ran in a few seconds so these aren't slow and none of the other steps are slow either. I don't see a problem.

 

Edit: The last LASR table load completed in15 seconds of real time. Multiply 15 by 9 tables and that is 2 mins 15 secs. The slowest step is the metadata update and that is 9 seconds. That's a bit slow. We run a similar LASR load process to you and ours take about 3 or 4 seconds.

 

Edit2: Try using PROC DATASETS to delete the LASR table rather than METALIB. That is quicker:

proc datasets library = LASRLIB nolist;
  delete LASRTable;
run;
quit;
SASno0b
Calcite | Level 5

Thank you for the analysis. When I run the job from the scheduler (Platform Process Manager ) it is taking roughly a little over 4 minutes.

Is it possible to do anything with parallel processing so that I can load all 9 tables simultaneously instead of sequentially 1 at a time?

 

I will try using your recommendation with proc datasets in the meantime.

 

 

SASKiwi
PROC Star

You could try splitting the job in two and running both at the same time in batch as an experiment. Is that quicker? Personally I don't think 4 minutes is a big deal 🙂 

SASno0b
Calcite | Level 5

Does using the proc datasets to delete the table replace both dropping the physical table step and dropping the table metadata step?

 

%if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do;
 proc datasets library = esd_lasr memtype=data nolist;
  delete &out_table;
run;
%end; /* Drop Physical Table - if exists */ %if %sysfunc(exist(esd_lasr.&out_table)) %then %do; proc sql noprint; drop table esd_lasr.&out_table; quit; %end; /* Drop Table Metadata - if exists */ %if %sysfunc(metadata_pathobj(,/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR/&out_table,,,)) %then %do; proc metalib; omr (library="/Shared Data/SAS Visual Analytics/ESD/Visual Analytics ESD LASR" repname="Foundation" ); select = ("&out_table"); update_rule = (delete); run; %end;
SASKiwi
PROC Star

Good question. I'm fairly sure the answer is no, but as long as you are reloading a table with the same name (even if the table structure changed) then updating the metadata afterwards that will keep the metadata in synch. You may also find that not deleting and recreating (as opposed to updating) your metadata every time might be faster.

SASno0b
Calcite | Level 5

I still have to drop the table metadata, it only deletes the physical table.

 

So I made some changes and managed to drop the runtime on the scheduler from 4:30 to 3:10. But the overall bottleneck is still having to load LASR sequentially one at a time when all 9 on the tables are independent of each other. 

 

Is there really no way to simultaneously load all 9 tables at once? 

I need them load all at the same time because users rely on the data refresh in VA to show all the correct data in one snapshot at the top of the hour. 

I can't have some of the data load at 9:01 AM and then some others load at 9:03 AM because I am using them as 9 datasources for the same VA report and it would be inaccurate.

SASKiwi
PROC Star

"I still have to drop the table metadata" - in my experience leaving the metadata loaded doesn't cause any problems and is quicker. For example if you reboot the LASR server then all tables get dropped but table metadata is still defined. This is by design.

 

So 2 or 3 minutes of data disruption is a problem? Is running the data load job outside of office hours a possibility? Personally I load LASR data daily at around 8am when there hardly anyone in the office.

 

Edit: Running in parallel requires separate SAS sessions which you can do easily if you have SAS/CONNECT available to you. IMHO this is overkill and running outside business hours would be a lot easier.  

 

 

 

 

SASno0b
Calcite | Level 5

It's a requirement because it runs every hour at the top of each hour so I don't have the luxury of out business hours for this.

 

I have an older SAS system distributed environment 9.4 (TS1M4) PROD that I tested the same identical program on and it completes it in an average time of 1 minute 30 seconds a run.

 

So I'm not sure why on my newer SAS system distributed environment 9.4 (TS1M7) DR that we are migrating to is taking over 4 minutes to complete the same thing. Each LASR load step is taking twice as long in the log for each.

SASKiwi
PROC Star

My understanding is that metadata changes are resource-intensive so you may want to have a chat with your SAS Administrator regarding your performance concerns. Why does PROC METALIB perform so much slower on your new SAS system? Is your metadata server getting heavily loaded?

 

I'd still recommend running a test that doesn't delete SAS table metadata first as that will likely remove that overhead completely.

ChrisNZ
Tourmaline | Level 20

Have you tried proc copy or proc append instead of a data step?

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 14 replies
  • 3515 views
  • 2 likes
  • 3 in conversation