BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Cornelis
Fluorite | Level 6

Dear SAS users,

 

I have written a simple program for preparing a HTML webplot normal probability.

Here is the SAS code:


%macro plot;

data pplot;
%do k=1 %to 10;
   y = ranuni(5);output;
%end;
run;

/*annotate to add a red circle in the probability plot*/
option mprint;
data anno1;
    x=0.6; y=50; text='circle'; size=3; position='3'; 
	color ='red'; style='arial'; xsys= '2'; ysys= '2'; function='symbol'; when = 'a'; output;
run;

/*Make a probability plot*/
goption reset = all device = jpg;

ods graphics on / width=5in;
ods graphics on / height=5in;
ods noproctitle;
filename odsout 'c:\temp'; 
ods html body="plot.html" path=odsout gpath=odsout;



ods graphics on;
proc univariate data=pplot noprint;
   probplot y / normal (mu=0.6481 sigma=0.2725) annotate=anno1
                      rotate;                     
		     label y = 'Y random';				 
run;

ods listing;
ods html close;

%mend plot;
%plot;

The problem is that the red circle is not visible in the annotate function, the webplot only shows a a normal probability plot:Probability Plot.png

Could you please find a solution how to make annote workable?

 

Best regards,

 

Cornelis

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @Cornelis,

 

The ANNOTATE= option of the PROBPLOT statement applies to "traditional graphics output" from SAS/GRAPH only (as does the GOPTIONS statement). By your ODS GRAPHICS ON statement, however, you decide against traditional graphics output (and use ODS graphics instead). So, if you want the annotation to work, you must switch ODS graphics off:

ods graphics off;

and, of course, omit the ODS GRAPHICS ON statements. Your width and height specifications then go into the GOPTIONS statement:

goptions reset = all device = jpeg vsize=5in hsize=5in;

Note that the DEVICE name is JPEG, not JPG (at least in my Windows SAS 9.4M5 installation; run 

proc gdevice catalog=sashelp.devices;
run;

to check). It uses a rather low resolution of 96 dpi. You can get 300 dpi with device = jpeg300.

 

By default, the legend ("Normal Line ...") is not created with traditional graphics. You may want to add an INSET statement to your PROC UNIVARIATE step to get something similar.

inset normal / pos=SE;

 

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @Cornelis,

 

The ANNOTATE= option of the PROBPLOT statement applies to "traditional graphics output" from SAS/GRAPH only (as does the GOPTIONS statement). By your ODS GRAPHICS ON statement, however, you decide against traditional graphics output (and use ODS graphics instead). So, if you want the annotation to work, you must switch ODS graphics off:

ods graphics off;

and, of course, omit the ODS GRAPHICS ON statements. Your width and height specifications then go into the GOPTIONS statement:

goptions reset = all device = jpeg vsize=5in hsize=5in;

Note that the DEVICE name is JPEG, not JPG (at least in my Windows SAS 9.4M5 installation; run 

proc gdevice catalog=sashelp.devices;
run;

to check). It uses a rather low resolution of 96 dpi. You can get 300 dpi with device = jpeg300.

 

By default, the legend ("Normal Line ...") is not created with traditional graphics. You may want to add an INSET statement to your PROC UNIVARIATE step to get something similar.

inset normal / pos=SE;

 

Cornelis
Fluorite | Level 6

Hello @FreelanceReinh ,

 

Thank you very much for your support. You are completely right, the 

ods graphics off;

 is the bottleneck. Using ODS graphics delivers more possibility to create nice graphs and annotate facilities.

 

Best rergards,

 

Cornelis

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 747 views
  • 2 likes
  • 2 in conversation