I am having a big performance issue with the macro I 've written, Extremely slow (no actual output) when runs with large input data sets., Appreciate any help in re writing the code. My code is as below. %macro getHistAllPlanteam(PPID,s_start_date); data pt_all_planteam_temp (keep=ParentPartyID All_Planners g_snapshot_start_date g_snapshot_end_date ); set &_INPUT1 (where=(Contact_planner ne "n/a" and ParentPartyID="&PPID" and g_snapshot_start_date="&s_start_date"dt)); by ParentPartyID Plan_mgmt_team_member; length All_Planners $255; if first.ParentPartyID then do; retain All_Planners; All_Planners=cat(trim(Plan_mgmt_team_member)," (",trim(Participant_Management_Role_Desc),")"); end; else do All_Planners=catx("; ",trim(All_Planners),cat(trim(Plan_mgmt_team_member)," (",trim(Participant_Management_Role_Desc),")")); end; if last.ParentPartyID then output; run; proc append base=&_OUTPUT1 data=pt_all_planteam_temp force; run; %mend getHistAllPlanteam; proc sql; delete from &_OUTPUT1; run; Data _Null_; set &_INPUT2; st_dtmval=put(g_snapshot_start_date,DATETIME.); call execute('%getHistAllPlanteam('||ParentPartyID||','||st_dtmval||')'); run; Below is a sample input; &_INPUT2 ParentPartyID g_snapshot_start_date g_snapshot_end_date 1-104O5G 26FEB15:00:00:00 01JAN99:00:00:00 &_INPUT1 ParentPartyID g_snapshot_start_date g_snapshot_end_date Plan_mgmt_team_member Participant_Management_Role_Desc 1-104O5G 26FEB15:00:00:00 1JAN99:00:00:00 David Addison Primary Planner 1-104O5G 6FEB15:00:00:00 01JAN99:00:00:00 Rachael Mayne Plan Support Coordinator Expected output: ParentPartyID All_plan_mgmt_team g_snapshot_start_date g_snapshot_end_date 1-104O5G David Addison (Primary Planner); Rachael Mayne (Plan Support Coordinator) 26FEB15:00:00:00 01JAN99:00:00:00
... View more