Hello, I'm trying to write a simple do loop where it'll iterate over a table a few times and create a new table. My logic is as follows
%MACRO conditions_1;
where contact = "IC"
%MEND conditions_1;
%MACRO conditions_2;
where contact = "IC"
and RTW_status = "RTW"
%MEND conditions_2;
proc sql;
create table IB_1 as
(select
invt_mth
, Inventory
, product
, age
,New_program
,count(contact) as contact_IC
,sum(exposure) as totalsum
from vv.maintenance
%conditions_1
group by 1,2,3,4,5
)
union all
(select
invt_mth
, Inventory
, age
, 'Overall' as product
, New_program
,count(contact) as contact_IC_Metric_1
,sum(exposure) as totalsum_Metric_1
from vv.maintenance
%conditions_1
group by 1,2,3,5
)
order by 1,2,3,4,5;
;
quit; I want my code to run from conditions 1 to 2, and each time, create a new table from IB_1 to 2 Thank you in advance for your help
... View more