In reply to Peter Styliadis.

I was running a parallel session a few days ago which has the layout like this:
proc cas;
sessions={};
source casl_code;
%do i=1 %to 5;
sessions[&i.] = create_parallel_session();
sessionProp.setSessOpt session=sessions[&i.] / caslib="&caslib";
datastep.runcode session=sessions[&i.] async="&file."/code=long_program /*<-- Here I prefer to use a source block to define this long_program inside of the same %do loop since it is contingent on each &i.*/
%end;
endsource;
sccasl.runCasl / code = casl_code;

Do you have a good solution for that?