This might be a long and stupid question...My goal is to either find a way to do what i want or understand why I can't/shouldn't do it.
I'm working on a project where I need to include some data steps inside a loop that I have created using IML.
The reason for this is that i need to manipulate the data by joining, inserting new variables and summing in order to reduce the size of the matrix calculations. I also need to do this (in some way) within a loop as I'm sampling data for each iteration. Firstly, as I'm new to using IML, is there a reason why it is not possible to just insert a data step in the middle of my IML code? I don't think it would be impossible to recreate the steps I've done using IML but I'd rather not do it. Is there a way to do this?
To clarify I want something like this:
proc iml;
iter = 5;
do i=1 to iter;
/* proc surveyselect data...*/
/*data steps*/
/*import variables from last data step to vectors*/
/* matrix calculations */
end;
;quit;
It seems to work using a macro and looping outside i.e:
%macro func();
%do iter=1 %to 5;
/*data steps*/
proc iml;
/*import variables from last data step to vectors*/
/* matrix calculations */
;quit;
%end;
%mend;
%func();
I would like to avoid this however as it less similar to the method i'm trying to implement and not as intuitive (in a mathematical sense). And a more vain reason is that I hate that all the color coding disappears when working inside a macro... maybe this is removable?
thanks!