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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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