Do you have a program containing complex macros with many levels of nesting? By using the mfile and mprint options you can save the generated SAS statements that are sent to the input stack. This can be very helpful for debugging. Simply add the following statements at the start of your program:

filename mprint “/path/to/MyResolvedCode.txt” lrecl=2048;
options mfile mprint ;

See documentation for more info.