I have the following macro and sometime the variable in the where clause will exist and sometimes it won't. %macro mem_det(tbl_, lice, sptc, type); proc sql; create table &tbl_ as select distinct ma_id ,i_id from data.Northwinds where License = "&lice" and UPCASE(TRIM(topic_name)) in ("&sptc") if %symexist(type) %then and Type = ("&type"); run; quit; %mend mem_det %mem_det(tbl_= TR_TEL_LIC, lice='LICENSED', sptc="contact", type=) /** in this instance the type isn't available **/ %mem_det(tbl_= TR_TEL_NONLIC, lice='NON-LICENSED', sptc="contact", type="FTE") Thanks,
... View more