I am testing my macro with below test dataset but a table with no rows is returned. Seems the SQL cannot recognize the condition in where clause. Please help to see what's wrong. Thanks a lot!
Test Dataset:
Index_1 | Index_2 |
---|---|
1 | x_1 |
1 | x_2 |
2 | x_1 |
2 | x_3 |
Code:
%macro looping;
%do i = 1 %to 1;
proc sql;
Create table TEMP as
select index_1, index_2, count(index_2) as Frequency
from work.test
where index_2 = 'x_&i.'
group by index_1, index_2;
quit;
%end;
%mend;