Hi I am trying to macro up a data step with array in it, however it causes loads of errors. Why is this?
This is the code I am trying to change into a macro:
data test;
set home_calls_stage4;
array stag3(*) Home_Call_Leads_3 date_3 yhat_3 Saturday_3 Sunday_3 xmas_boxing_3 easter_fri_mon_3 bank_hols_3
Mix_NP_3wk_tail_3 Mix_DM_XS_Tail_C_3 Mix_DM_NTG_tail_B_3 Home_DM_all_tailA_3 Home_Search_Total_cost_3;
array stag3s(*) Home_Call_Leads_3s date_3s yhat_3s Saturday_3s Sunday_3s xmas_boxing_3s easter_fri_mon_3s bank_hols_3s
Mix_NP_3swk_tail_3s Mix_DM_XS_Tail_C_3s Mix_DM_NTG_tail_B_3s Home_DM_all_tailA_3s Home_Search_Total_cost_3s;
array stag4(*) Home_Call_Leads_4 date_4 yhat_4 Saturday_4 Sunday_4 xmas_boxing_4 easter_fri_mon_4 bank_hols_4
Mix_NP_4wk_tail_4 Mix_DM_XS_Tail_C_4 Mix_DM_NTG_tail_B_4 Home_DM_all_tailA_4 Home_Search_Total_cost_4;
do i=1 to dim(stag3);
stag4(i)=((stag3(i)/stag3s(i))*sum(money_off)) + stag3(i);
end;
run;
This is the code I am trying to change into a macro:
data test;
set home_calls_stage4;
array stag3(*) Home_Call_Leads_3 date_3 yhat_3 Saturday_3 Sunday_3 xmas_boxing_3 easter_fri_mon_3 bank_hols_3
Mix_NP_3wk_tail_3 Mix_DM_XS_Tail_C_3 Mix_DM_NTG_tail_B_3 Home_DM_all_tailA_3 Home_Search_Total_cost_3;
array stag3s(*) Home_Call_Leads_3s date_3s yhat_3s Saturday_3s Sunday_3s xmas_boxing_3s easter_fri_mon_3s bank_hols_3s
Mix_NP_3swk_tail_3s Mix_DM_XS_Tail_C_3s Mix_DM_NTG_tail_B_3s Home_DM_all_tailA_3s Home_Search_Total_cost_3s;
array stag4(*) Home_Call_Leads_4 date_4 yhat_4 Saturday_4 Sunday_4 xmas_boxing_4 easter_fri_mon_4 bank_hols_4
Mix_NP_4wk_tail_4 Mix_DM_XS_Tail_C_4 Mix_DM_NTG_tail_B_4 Home_DM_all_tailA_4 Home_Search_Total_cost_4;
do i=1 to dim(stag3);
stag4(i)=((stag3(i)/stag3s(i))*sum(money_off)) + stag3(i);
end;
run;