BookmarkSubscribeRSS Feed
karen8169
Obsidian | Level 7
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;
 
1 REPLY 1
Ksharp
Super User
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;

AI Navigator GIF.gif


Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.

Check it out on Microsoft Marketplace →

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1604 views
  • 0 likes
  • 2 in conversation