@ballardw wrote: @polksio wrote: Thank you for your answer Kurt, the need for macros come from the fact that there are dozens of "xs and ys" which create the need for macro loops and then more operations are done on the x and y columns so I was trying to integrate the proc format value extraction within said loops, but if its not feasible I'll carve out this step outside the loops with your suggestion. This indicates that perhaps your "example" is incomplete. If your example does not provide enough information to cover all of the cases then there is no way we can provide working solutions. Still doubt that macro loops are needed. Apologies for any incomplete or erroneous info and appreciate your effort @ballardw, the other operations that would be included in this loop are mainly some multiplication and some addition. My intent was to simplify the request but please find below the full routine that is repeated for a couple of other factors. I'm certain as you said macros are not needed but part of the request was to use them. %Macro step0;
DATA want;
SET have;
attrib sum_prime sum sum_prime_x sum_x format=10.5;
sum_prime = 0;
sum = 0;
sum_prime_x = 0;
sum_x = 0;
%LET name_list = aaa bbb ccc ddd eee fff ggg hhh
iii jjj kkk lll mmm nnn ooo ppp qqq rrr sss ttt;
%LOCAL i next_name;
%LET i=1;
%DO %WHILE (%SCAN(&name_list, &i) ne );
%LET next_name = %SCAN(&name_list, &i);
attrib &next_name._step0 &next_name._step0_x format=10.5;
&next_name._step0 = &next_name._raw;
&next_name._step0_x = &next_name._adjusted_raw;
%LET i = %EVAL(&i + 1);
%END;
%LET name_list = aaa bbb ccc ddd eee fff ggg hhh ;
%LOCAL i next_name;
%LET i=1;
%DO %WHILE (%SCAN(&name_list, &i) ne );
%LET next_name = %SCAN(&name_list, &i);
p&next_name.factor_prime = put(factor_prime, R1&next_name.factor.);
p&next_name.factor = put(factor, R1&next_name.factor.);
&next_name._step0 = &next_name._step0 * p&next_name.factor_prime / p&next_name.factor ;
&next_name._step0_x = &next_name._step0_x * p&next_name.factor_prime / p&next_name.factor ;
%LET i = %EVAL(&i + 1);
%END;
%LET name_list = aaa bbb ccc ddd eee fff ggg hhh
iii jjj kkk lll mmm nnn ooo ppp qqq rrr sss ttt;
%LOCAL i next_name;
%LET i=1;
%DO %WHILE (%SCAN(&name_list, &i) ne );
%LET next_name = %SCAN(&name_list, &i);
sum = sum + &next_name._step0;
sum_x = sum_x + &next_name._step0_x;
IF &i. < 9 THEN DO;
sum_prime = sum_prime + &next_name._step0;
sum_prime_x = sum_prime_x + &next_name._step0_x;
END;
%LET i = %EVAL(&i + 1);
%END;
RUN;
%MEND;
%step0; I hope the first example with the corrected proc formats is sufficient, I've been exploring using resolve() call symput, and many other options to resolve a &format_version. macro variable inside the put functions which would integrate well with the program. Any leads you think are promising I can investigate futher? Thank you,
... View more