Hi TJ, I haven't tested the attached as you haven't provided any data, but hopefully it makes sense. If you have each of your scenarios in a dataset, which I assume you can achieve on your own, using a Call Execute will allow for you to use values in the relevant variables as part of your statements, functions and the like. DATA _NULL_; SET SAMPLES (END=EOF); STR =COMPBL( "PROC LOGISTIC DATA = HAVE; MODEL "|| SITE || " (EVENT='1')=" || EXP || ";"; CALL EXECUTE (STR); IF EOF THEN DO; STR = 'RUN;'; CALL EXECUTE (STR); END; RUN; The following gives you a simple example of code that works. We are accessing the Dictionary View VCOLUMN to identify all the columns in SASHELP.CLASS and executing a sort on each of the variables. DATA _NULL_; SET SASHELP.VCOLUMN (WHERE =(LIBNAME = "SASHELP" AND MEMNAME = "CLASS")) END=EOF; STR =COMPBL( "PROC SORT DATA = SASHELP.CLASS OUT = SORTCLASS ; BY " || NAME || ";"); CALL EXECUTE (STR); IF EOF THEN DO; STR = 'RUN;'; CALL EXECUTE (STR); END; RUN;
... View more