Hi, I would like to know how to use the find function with arrays. Here is what I have : data want; set have;
y1 = find(var, trim("&yes1"), 'i');
y2 = find(var, trim("&yes2"), 'i');
y3 = find(var, trim("&yes3"), 'i');
n1 = find(var, trim("&no1"), 'i');
n2 = find(var, trim("&no2"), 'i');
n3 = find(var, trim("&no3"), 'i');
run; I would like to optimize my program and do something like this : data want; set have;
array y {*} y1-y3;
do i = 1 to dim(y);
y(i) = find(var, trim("&yes(i)"), 'i');
end;
array n {*} n1-n3;
do i = 1 to dim(n);
n(i) = find(var, trim("&no(i)"), 'i');
end;
run; Can anyone help me with that? Thank you.
... View more