I agree with Ian.
Your program is currently structured like this:
%DO loops: grid in (lambda, h) space
%DO simulation loop (10,000 iterations)
call PROC IML
write one observation
call PROC APPEND to append obs
%END simulation
call PROC MEANS to get mean, std, and sterr of simulation with given (lambda, h)
%END grid loops
To make it more efficient, structure it like this:
call PROC IML
CREATE output var {lambda h mean std stderr}; /* open data for results */
DO loops: grid in (lambda, h) space
DO simulation loop (10,000 iterations)
accumulate simulated data in rows of matrix
END simulation
Use SAS/IML functions (MEAN, STD,...) to get mean/std/stderr of simulation with given (lambda, h)
APPEND; /* write results to data set */
END grid loops