One of the convenient SAS features I enjoy is the #byval feature in procedures such as proc gplot, proc report, etc. without resorting to macros. the obvious limitation is that it only works for one proc at a time, so if I want to run a series of procedures one by-group at a time (e.g., proc odstext followed by proc report for the first by-group, repeat for the second, etc.), I cannot do that without resorting to macros.
Would it make sense to create a new procedure such as proc encapsulate that would enable the user to have more control over procedures? An example of a rough sketch would be (example modified to make it more clear that all datasets involve require common primary level masterby variables).
proc encapsulate;
masterby MASTERVAR1;
proc odstext data=input_data "This is the report section for #masterbyval1"; quit;
within MASTERVAR1 do over MASTERVAR2;
Title "Text for #masterbyvar(MASTERVAR1) #masterbyvar(MASTERVAR2)";
proc report data=input_data2;
run;
endcomp;
run;