I believe that @broth38 has an existing process that was creating SQL statements from a csv, but couldn't figure out how to run them once created. Judging by the input statement in the reply, the csv might list out different variable transformations/equations to be dynamically created. For example: data have;
length statement $ 1000;
statement = "create table want as";
output;
statement = "select";
output;
statement = "*";
output;
statement = "from have2;";
output;
run;
data want;
set have end=last;
retain sqlStr;
length SqlStr $10000;
sqlStr = catx(" ", sqlString, statement);
if last then do;
sqlStr = catx(" ", "PROC SQL;", StrSQL, "QUIT;");
output;
end;
run;
data _NULL_; set want; call execute(sqlStr); run; The have dataset is where the SQL strings are being created (I can't ever get datalines to work right the first time which is why there is a bunch of output statements in there). The want dataset is where SAS puts together the SQL string to be ran. The data _NULL_ step is when that SQL code is ran (I broke it out into a separate step from my previous reply).
... View more