Hi all,
Please i think i need help here.
I Have a proc sql code running for more than 4 hours to give me an output.
the dataset on the left (Base0) has only 1 million rows, but Base2 is a remote dataset in a global repository.
PLEASE why does it takes so long to execute (4 hours) ?
How can it be optimized ?
NB Note than the key variable doesnt have the same structure in both dataset.
Thanks
proc sql;
create table lib1.Base1 as
select a.*, b.DW_DATE_KEY, b.SERVICE_CLASS,
b.TOTAL_VOICE_AMT,b.TOTAL_DURATION,
b.NB_CALLS, b.NB_CALLS_ONNET, b.NB_CALLS_OFFNET,b.NB_CALLS_INTERNATIONAL,
b.VOICE_AMT_ONNET,b.VOICE_AMT_OFFNET,b.VOICE_AMT_INTERNATIONAL,
b.VOICE_DUREE_ONNET,b.VOICE_DUREE_OFFNET , b.VOICE_DUREE_INTERNATIONAL,
b.MA_VOICE_USED, b.BONUS_VOICE_USED
from lib1.Base0 as a
left join lib2.Base1(where =(DW_DATE_KEY >= 20160516 and DW_DATE_KEY <=20160630)) as b
on a.msisdn =(input(b.msisdn, best12.)-237000000000);
quit;
A guess that should help.
Copy the subset of lib2 to WORK and do the ID transform during the copy. The left join may be making multiple passes through lib2 and input is not the most efficient function in SAS.
A guess that should help.
Copy the subset of lib2 to WORK and do the ID transform during the copy. The left join may be making multiple passes through lib2 and input is not the most efficient function in SAS.
I'd fetch the base2 table to a local SAS dataset in a separate step. In that step, do the calculation for your key. Then sort per the key, which should make things much easier for the SQL step.
You might still find that proc sort and a data step merge are faster. If you have a many-to many relationship requiring a cartesian join, you must use SQL, of course.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.