Data MCint;
call streaminit(12345);
do isim=1 to 10000;
Ux = rand("UNIFORM");
Uy = rand("UNIFORM");
Under = (Uy<=sqrt(1-Ux**2));
drop isim;
output;
end;
run;
ODS OUTPUT OneWayFreqs=data_freq;
proc freq;
table Under;
run;
proc print data =data_freq;run;
data _null_;
set data_freq;
if under=1;
PI_est=4*Percent/100;
prop_est=Percent/100;
SE_PI_EST=4*sqrt(prop_est*(1-pop_est)/10000);
PI_CI_Low=PI_est-2*SE_PI_EST;
PI_CI_Up=PI_est-2*SE_PI_EST;
file print;
put ' ------------------------------------------';
put ' | MC Integration estimate of PI |';
put ' ------------------------------------------';
put ' PI(estimate)=' PI_est;
put ' SE[PI(estimate)]=' SE_PI_EST;
put ' Approx. 95% CI=' PI_CI_Low' ,' PI_CI_Up;
put ' ' ;
put ' Based on 10,000 simulated points.' ;
put ' ------------------------------------------' ;
run;
ods graphics / imagename="Circle" antialiasmax=11000;
proc sgplot data=MCint aspect=1;
scatter x=Ux y=Uy / group=Under markerattrs=(symbol=Plus size=5);
xaxis min=0 max=1;
yaxis min=0 max=1;
run;It a question after the previous question and the answer is above. I found that I can't control color of the dot in the program when I use the previous command. Where should I rewrite the code?
ods graphics / reset width=50px height=300px;
symbol1 value=dot color=black;
symbol2 value=dot color=yellow;
ods graphics /imagename="Circle" antialiasmax=11000; proc sgplot data=MCint aspect=1; styleattrs datacontrastcolors=(black yellow); scatter x=Ux y=Uy / group=Under markerattrs=(symbol=circlefilled size=5); xaxis min=0 max=1; yaxis min=0 max=1; run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.