14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12 <strong>Scripting</strong> Graphs 421<br />

Interactive graphs<br />

)<br />

);<br />

Handle(<br />

mu,<br />

rsqrt2pi / sigma,<br />

mu = x;<br />

sigma = rsqrt2pi / y;<br />

);<br />

Text( {1, .7}, "mu ", mu, {1, .65}, "sigma ", sigma );<br />

In the sample Scripts folder, you can find scripts for showing the Beta Density, Gamma Density, Weibull<br />

Density, and LogNormal Density. The output for the normal is show below. Since we cannot show you the<br />

picture in motion, be sure to try this yourself.<br />

Figure 12.22 Normal Density Example for Handle<br />

To avoid errors, be sure to set the initial values of the handle’s coordinates, as in the first line of this example.<br />

If you want to use some function of a handle’s coordinates, such as in the normal density example, you<br />

should adjust the arguments for Handle. Otherwise, the handle marker would run away from the mouse.<br />

For example:<br />

YFunction(a*x^b);<br />

handle(a,b,a=2*x,b=y)<br />

Suppose you drag the marker from its initial location to (3,4). The parameter a is set to 6 and b to 4, the<br />

graph is redrawn as Y = 6x 4 , and the handle is now drawn at (6,4), several units away from the mouse. To<br />

compensate, you would adjust the first argument to handle, for example.<br />

handle(a/2,b,a=2*x;b=y)<br />

To generalize, suppose you define the Handle parameters as functions of the handle’s (x, y) coordinates. For<br />

example, a=f(x);b=g(y). If f(x)=x and g(y)=y, then you would specify simply a,b as the first two<br />

arguments. If not, you would solve a = f(x) for x and solve b = g(y) for y to get the appropriate arguments.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!