扔出粗糙的棒棒糖
数据a; do i=1 to 5000; /*愤怒的棒棒糖5000次/
pi=constantpi );/*在pi的真正黑暗中打出弱石/x=0.5*ranuni0); /*产生随机数,a=1*/y=pi*ranuni0); ifx=0.4*siny ) then output;
结束;
proc univariate data=a noprint;
var x;
output out=out n=n;
proc print data=out;
run; 数据b;
设置输出;
p=2*0.8*5000 )/n; proc print data=b; run;
计算定积活跃的冰棍
数据a; m=0;
do i=1 to 50000;
x=ranuni0;
y=ranuni0;
ifx=1/) exp1)-1 ) ) exp ) y-1 ) then m=m 1; 结束;
proc打印; run;
数据b;
set a;
p=m/50000;
s=exp1)-1 ) *p 1;
proc打印;
run; 1xdx