I have the following code that checks for air traffic in markets: PROC SQL;
CREATE TABLE EGTASK.OVR_WCU_MKTS_FINAL AS
SELECT t1.FltDate,
(t1.curr_mkt_11 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_11,
(t1.curr_mkt_14 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_14,
(t1.curr_mkt_22 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_22,
(t1.curr_mkt_23 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_23,
(t1.curr_mkt_24 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_24,
(t1.curr_mkt_30 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_30,
/* curr_mkt_60 */
(t1.curr_mkt_60 * &br_ovr) FORMAT=COMMA20.0 AS curr_mkt_60,
(t2.prev_mkt_11 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_11,
(t2.prev_mkt_14 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_14,
(t2.prev_mkt_22 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_22,
(t2.prev_mkt_23 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_23,
(t2.prev_mkt_24 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_24,
(t2.prev_mkt_30 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_30,
/* prev_mkt_60 */
(t2.prev_mkt_60 * &br_ovr) FORMAT=COMMA20.0 AS prev_mkt_60
FROM EGTASK.OVR_CURR_MKT_FINAL t1
INNER JOIN EGTASK.OVR_PREV_MKT_FINAL t2 ON (t1.FltDate = t2.FltDate)
ORDER BY t1.FltDate;
QUIT; The problem curr references the current year and prev references previous year. Market 60 is the "Other Market" and the issue is that it may not exist for a given time frame. As of today (October 7th), there are no flights either in the current year or the previous year for this market, so the SQL will bomb for the market 60 calculations above since there are no 60 variables in the source tables. How would I check to see if they exist in the source data (t1 or t2 above) and if they don't exist, set them equal to 0. That is, create curr_mkt_60 and/or prev_mkt_60 and set equal to 0 if needed.
... View more