Debugging Stored Processes

One challenge that developers have when working with stored processes, is access to the work library.  Whilst sessions can be configured to persist, this does not help if you want to view a snapshot of your datasets at a particular point in the process.   The following snippet may help in this regard:
libname twork “&tloc”;
proc datasets lib=twork kill
proc copy inlib=work outlib=twork;
data _Null_;
file “&tloc/macros.txt”;
set sashelp.vmacro;
put name ‘=’ value;

libname twork clear;