I think you want something as (not tested) :
data _null_;
set work.test3(keep = &input_var2.);
call execute(cats("data work.input_var2.",_N_,"; set work.test; where &input_var2.=",&input_var2.,"; run;"));
run;
EDIT : A more complete macro that checks the column type :
data test3;
input group $ val;
cards;
A 1
B 2
C 3
D 4
;
run;
data test;
input group $ val;
cards;
A 1
C 3
;
run;
%macro split(input_var2);
data _null_;
set work.test3(keep = &input_var2.);
if vtype(&input_var2.)="C" then do;
call execute(cats("data work.&input_var2.",_N_,"; set work.test; where &input_var2.='",&input_var2.,"'; run;"));
end;
else do;
call execute(cats("data work.&input_var2.",_N_,"; set work.test; where &input_var2.=",&input_var2.,"; run;"));
end;
run;
%mend;
%split(group);
%split(val);
I am not sure you really need to do that though. Why do you want to split your datasets this way ?
... View more