I have the current code which calls a macro "WATERFALL_V4" just fine when running my original program. The code is: %MACRO WATERFALL_v4(Prog); and the call is: %waterfall_v4(Reg)
%if "&Exist" = "YES" %then %do; %waterfall_v4(ALT) %end;
The Exist Macro is defined earlier and applies to each observation. The first dataset this Macro is run on is written as:
DATA EligibleLoans_&Prog (KEEP = Mod_Pmt_&Prog Mod_Rte_&Prog Mod_Trm_&Prog Mod_Fore_&Prog new_front_end_ratio_&Prog
RENAME = (Mod_Pmt_&Prog = Calc_Mod_Pmt_&Prog Mod_Rte_&Prog = Calc_Mod_Rte_&Prog Mod_Trm_&Prog = Calc_Mod_Trm_&Prog Mod_Fore_&Prog = Calc_Mod_Fore_&Prog new_front_end_ratio_&prog = new_dti_&Prog));
SET LoansForNPV_&Prog; RUN;
This code ran fine until I tried to place it in another Macro "Quarters", which simply runs the originally dataset after it is segmented into smaller date ranges. The new code for the first run within the WATERFALL_V4 Macro now reads:
DATA EligibleLoans_&Prog_&QTR. (KEEP = Mod_Pmt_&Prog Mod_Rte_&Prog Mod_Trm_&Prog Mod_Fore_&Prog new_front_end_ratio_&Prog
RENAME = (Mod_Pmt_&Prog = Calc_Mod_Pmt_&Prog Mod_Rte_&Prog = Calc_Mod_Rte_&Prog Mod_Trm_&Prog = Calc_Mod_Trm_&Prog Mod_Fore_&Prog = Calc_Mod_Fore_&Prog new_front_end_ratio_&prog = new_dti_&Prog));
SET LoansForNPV_&Prog_&QTR.; RUN;
For some reason that I can't figure out, placing the WATERFALL_V4 macro within the QUARTERS macro now returns this error, indicating that the &prog call is no longer working and is just being read as PROG_ (even though the second line below says "Parameter PROG has value Reg"):
MLOGIC(WATERFALL_V4): Beginning execution.
MLOGIC(WATERFALL_V4): Parameter PROG has value Reg
WARNING: Apparent symbolic reference PROG_ not resolved.
NOTE: Line generated by the invoked macro "WATERFALL_V4".
1 DATA EligibleLoans_&Prog_&QTR.(KEEP = -
22
ERROR: Undeclared array referenced: Prog_2010Q4.
NOTE: Line generated by the invoked macro "WATERFALL_V4".
1 Mod_Pmt_&Prog
----------
388
76
1 ! Mod_Rte_&Prog Mod_Trm_&Prog Mod_Fore_&Prog new_front_end_ratio_&Prog RENAME =
1 ! (Mod_Pmt_&Prog = Calc_Mod_Pmt_&Prog Mod_Rte_&Prog = Calc_Mod_Rte_&Prog
NOTE: Line generated by the macro variable "QTR".
1 Prog_2010Q4
-----------
Please help! This is driving me crazy!