I am trying to conditionally call a macro based on identifiers in an array, and have the macro variable change based on the value of the array. Here is my code:
data;
array file(*) $ file1-file7;
array prog(*) $ prog1-prog7;
do i=1 to dim(prog);
if prog(i) = "Y" then
call execute("%findit(name(file(i)))");
end;
run;
As an example:
%let file1 = C:\file.doc
%let prog1 = Y
I would expect that my code would create arrays for the file and prog variables that are defined earlier in my code. Then, it would begin cycling through the array. The first iteration would conditionally execute the macro statement, because the prog1 variable is Y. Then, the macro would execute using the value of file1 ("C:\file.doc") as the macro variable.
The conditional logic appears to be working. However, the macro executes on "name(file(I)))" instead of on "C:\file.doc".
Does anyone see my mistake?
%LETstatements have to do with the code you posted?