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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.