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.

64 <strong>Scripting</strong> Tools Chapter 4<br />

Debug Scripts<br />

Using Breakpoints and Watching Global Variables<br />

The following example shows how to set a breakpoint in a loop and watch variables change through each<br />

iteration of the loop.<br />

1. Open the string.jsl sample script and click the Debug Script button.<br />

2. Click in the margin for line 12 to add a breakpoint (Figure 4.10).<br />

You should have a breakpoint for the following expression inside the For() loop:<br />

stringFunction(i);<br />

Figure 4.10 Set the Breakpoint<br />

3. Click Run.<br />

The first two expressions are evaluated:<br />

– stringFunction is defined as a function.<br />

– str is defined as an empty string.<br />

Both variables and their types and values have been added to the Globals list. In addition, the For()<br />

loop has been evaluated up to the line with the breakpoint, shown in Figure .<br />

– i has been assigned to 0.<br />

– i and its value and type have been added to the Globals list.<br />

– i has been determined to be less than or equal to 9.<br />

– stringFunction() has not yet been called.<br />

Figure 4.11 View the Initial Global Variables

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

Saved successfully!

Ooh no, something went wrong!