Rejection sampling is an important concept in MC simulation.
Here is an example to illustrate the idea.
The details refer to the link below.
http://en.wikipedia.org/wiki/Rejection_sampling
****reject sampling ****;
%let target_dist_pdf=pdf('normal',x);
%let sample_dist_pdf=pdf('CAUCHY',x);
%let m=sqrt(2*constant('pi')/CONSTANT('E')); 
;
data t1;
  CALL STREAMINIT(123); 
  do i=1 to 10000;
    u=rand('unif');
    x=rand('cauchy');
    if u <=&target_dist_pdf/(&m*&sample_dist_pdf) then flag=1;
    else flag=0;
    output;
  end;
  run;
  proc print data=t1(obs=10);
  run;
  proc freq data=t1;
  table flag;
  run;
  proc univariate data=t1;
  var x;
  histogram x/normal;
  where flag=1;
  run;