I am trying to use a SAS macro to do a conditional procedure. I set a region name, and if it's in a subset then I want it to do something differently. The code is: %macro merge_RF(region_data);
%if "®ion_data" in ('Brazil', 'HK', 'Malaysia', 'Singapore', 'Taiwan', 'Thailand') %then %do; * for regions with no better data, use MPT risk free index;
proc sort data = ts_fund2; by Risk_Free_Rate_ID date; run;
data ts_fund3;
merge ts_fund2 (in = a) use.idx5;
by Risk_Free_Rate_ID date;
if a;
run;
%end;
%else %do;
proc sort data = ts_fund2; by date; run;
data ts_fund3;
merge ts_fund2 (in = a) use.OECD_rf2 (where = (region = "®ion_data"));
by date;
if a;
run;
%end;
%mend merge_RF;
%merge_RF(region_input); However, when I run it, the error message I got is ERROR: Required operator not found in expression: "®ion_data" in ('Brazil', 'HK', 'Malaysia', 'Singapore', 'Taiwan', 'Thailand') ERROR: The macro MERGE_RF will stop executing. What's wrong in my code? Edit: I forgot to mention this: the input region (region_input) is a macro variable defined earlier, such as %let region = Japan;
... View more