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

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 521 views
  • 2 likes
  • 2 in conversation