I realize that it's probably not the most elegant solution, but I did come up with a work around for my issue, so thank you to PGStats annd ballardw for looking at my question. Since my second post was probably not as clear as it could have been, I'll clarify as well. Basically, I had something similar to the below macro, which calculated costs depending on whether a particular data point belonged to a particular category. %macro cost_in_category (cat_1, cat_2, cat_3); data table; set othertable; if category=1 then cost=&cat_1.; if category=2 then cost=&cat_2.; if category=3 then cost=&cat_3.; run; %MEND; I have several permutations of cat_1,2,3, so rather than doing %cost_in_category(1,2,3); %cost_in_category(1,2,4); %cost_in_category(2,3,5); etc. I wanted some code to automatically calculate these for me. I would import the permutations from a table that looked something like: n cat_1 cat_2 cat_3 1 1 2 3 2 1 2 4 3 2 3 5 My solution was to create an extra step in my macro, and restrict my permutation table to record i. %macro cost_in_category ; %do i = 1 %to <number of records in table>; data costcat_&i.; SET permutations_table; WHERE n = &i. run; PROC SQL; create table base_data_with_costcats_&i. as SELECT a.*, b.* FROM base_data a, costcat_&i b; QUIT; data table; set base_data_with_costcats_&i; if category=1 then cost=cat_1; if category=2 then cost=cat_2; if category=3 then cost=cat_3; run; %END; %MEND;
... View more