JeanDo and Tom, thanks for taking a look at the problem. I've been working on this and came up with another approach that uses symputx to store the macro variables. This is an interim analysis example. There are 4 look points, and the user can define the portion of alpha that they want to 'spend' at each look point. Data are entered cumulatively. Right now, I have each of the alpha_looks stored as separate macro variables using symputx. When alpha_spend=3 (meaning the user wants to enter their own alpha values instead of relying on what's generated through code), the main macro will pull these values in. I'm having some trouble with the last step, and I've made comments to highlight where the problem is. Thanks for taking a look! I've used a lot of the community input to make changes to this code. data UserDefAlpha; /*input alpha_look=3 in main macro to use user-defined alpha values*/
input numuser @;
call symputx("numuser",numuser,'G');
do i=1 to &numuser;
input alpha_look @;
output;
end;
/*first value of datalines must be num_look(the number of looks)*/
datalines;
4 0.011 0.015 0.02 0.025
;
run;
data UserDefAlpha2;
set UserDefAlpha;
do j=1 to &numuser;
if j=i then
call symputx(catt('alpha_look',j),alpha_look,'G');
end;
run;
%put alpha_look1 = &alpha_look1;
%put alpha_look2 = &alpha_look2;
%put alpha_look3 = &alpha_look3;
%put alpha_look4 = &alpha_look4;
%macro example(alpha_spend=);
data example;
array alpha_look[&numuser] alpha_look1 - alpha_look&numuser;
if &alpha_spend = 3 then
do j=1 to &numuser;
alpha_look[j] = &&alpha_look&j ; /*the &j portion on the right hand side of the equation does not work*/
*alpha_look[j] = &&alpha_look1 ; /*this line of code works, but I want to dynamically reference the stored macro variables, instead of just alpha_look1*/
end;
run;
proc print; run;
%mend;
%example(alpha_spend=3);
... View more