14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

368 Display Trees Chapter 11<br />

Constructing Display Trees<br />

Y Scale( ymin, ymax ),<br />

Line Style( 2 ),<br />

H Line( 0 ),<br />

Line Style( 0 ),<br />

Y Function( polynomial, x ),<br />

Line Style( 3 ),<br />

Pen Color( 3 ),<br />

V Line( xx[1] ),<br />

V Line( xx[2] ),<br />

Marker Size( 2 ),<br />

Marker( 0, {xx[1], 0}, {xx[2], 0} )<br />

)<br />

)<br />

);<br />

);<br />

/* If no (for example, with a=3, b=4, c=5), put up an error window with a<br />

helpful graph: */<br />

error = Expr(<br />

New Window( "Error",<br />

V List Box(<br />

Text Box( " " ),<br />

Text Box( " Polynomial " || po || " has no real roots. " ),<br />

Text Box( " " ),<br />

Text Box( "Examine a graph of the function to get an idea why." ),<br />

Graph Box(<br />

framesize( 200, 200 ),<br />

X Scale( -20, 20 ),<br />

Y Scale( -20, 20 ),<br />

Line Style( 2 ),<br />

H Line( 0 ),<br />

Line Style( 0 ),<br />

Y Function( polynomial, x )<br />

)<br />

)<br />

)<br />

);<br />

/* Either way, the script needs to have some strings ready. Rewrite the<br />

polynomial with the coefficients specified: */<br />

polynomial = Expr( a * x ^ 2 + b * x + c );<br />

//Store this instance of the polynomial as a string:<br />

po = Char( Eval Expr( polynomial ) );<br />

//Store the solution list as a string:<br />

xxx = Char( Eval Expr( x ) );<br />

//Now it's ready for the test:<br />

If( Is Missing( xx[1] ) | Is Missing( xx[2] ),<br />

error,<br />

results<br />

);<br />

When you run this script, you first see a window like this:

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

Saved successfully!

Ooh no, something went wrong!