is it possible to use wildcards in the keep of a data step? I want to do the following (left join of A on B keeping variables x and y and all variables starting with a):
data C;
merge A(in=a)
B(keep= x y var* in=b);
by x y;
if a;
run;
Yes, use
:.(It’s not a good idea to say
in=aif you have a variable nameda.)If you have variables with sequential numbers, like
a1,a2, …,aN, you can writea1-aN. And if you want a set of adjacent columns (sayvarX,varY, andvarZare physically adjacent in the data set), you can sayvarX--varZ. The difference between these two examples is just whether you use one dash or two.