Dictionary


BREAK

Suspends program execution at an executable statement

Category: Manipulating Debugging Requests

Alias: B

Syntax

BREAK location <AFTER count > <WHEN expression ><DO group >

Arguments

location

  • specifies where to set a breakpoint. Location must be one of these:

label

a statement label. The breakpoint is set at the statement that follows the label.

line-number

the number of a program line at which to set a breakpoint.

*

the current line.

AFTER count

  • honors the breakpoint each time the statement has been executed count times. The counting is continuous. That is, when the AFTER option applies to a statement inside a DO loop, the count continues from one iteration of the loop to the next . The debugger does not reset the count value to 1 at the beginning of each iteration.

    If a BREAK command contains both AFTER and WHEN, AFTER is evaluated first. If the AFTER count is satisfied, the WHEN expression is evaluated.

    Tip: The AFTER option is useful in debugging DO loops .

WHEN expression

  • honors a breakpoint when the expression is true.

DO group

  • is one or more debugger commands enclosed by a DO and an END statement. The syntax of the DO group is

    • DO; command-1 < ... ; command-n ; >END;

  • command

    • specifies a debugger command. Separate multiple commands by semicolons.

      A DO group can span more than one line and can contain IF-THEN/ELSE statements, as shown:

      • IF expression THEN command ; <ELSE command ;>

      • IF expression THEN DO group ; <ELSE DO group ;>

    • IF evaluates an expression. When the condition is true, the debugger command or DO group in the THEN clause executes. An optional ELSE command gives an alternative action if the condition is not true. You can use these arguments with IF:

    • expression

      • specifies a debugger expression. A non-zero , nonmissing result causes the expression to be true. A result of zero or missing causes the expression to be false.

    • command

      • specifies a single debugger command.

    • DO group

      • specifies a DO group.

Details

The BREAK command suspends execution of the DATA step at a specified statement. Executing the BREAK command is called setting a breakpoint .

When the debugger detects a breakpoint, it

  • checks the AFTER count value, if present, and suspends execution if count breakpoint activations have been reached

  • evaluates the WHEN expression, if present, and suspends execution if the condition that is evaluated is true

  • suspends execution if neither an AFTER nor a WHEN clause is present

  • displays the line number at which execution is suspended

  • executes any commands that are present in a DO group

  • returns control to the user with a > prompt.

If a breakpoint is set at a source line that contains more than one statement, the breakpoint applies to each statement on the source line. If a breakpoint is set at a line that contains a macro invocation, the debugger breaks at each statement generated by the macro.

Examples
  • Set a breakpoint at line 5 in the current program:

     b5 
  • Set a breakpoint at the statement after the statement label eoflabel :

     b eoflabel 
  • Set a breakpoint at line 45 that will be honored after every third execution of line 45:

     b 45 after 3 
  • Set a breakpoint at line 45 that will be honored after every third execution of that line only when the values of both DIVISOR and DIVIDEND are 0:

     b 45 after 3         when (divisor=0 and dividend=0) 
  • Set a breakpoint at line 45 of the program and examine the values of variables NAME and AGE:

     b 45 do; ex name age; end; 
  • Set a breakpoint at line 15 of the program. If the value of DIVISOR is greater than 3, execute STEP; otherwise , display the value of DIVIDEND.

     b 15 do; if divisor>3 then st;             else ex dividend; end; 

CALCULATE

Evaluates a debugger expression and displays the result

Category: Manipulating DATA Step Variables

Syntax

CALC expression

Arguments

expression

  • specifies any debugger expression.

  • Restriction: Debugger expressions cannot contain functions.

Details

The CALCULATE command evaluates debugger expressions and displays the result. The result must be numeric.

Examples
  • Add 1.1, 1.2, 3.4 and multiply the result by 0.5:

     calc (1.1+1.2+3.4)*0.5 
  • Calculate the sum of STARTAGE and DURATION:

     calc startage+duration 
  • Calculate the values of the variable SALE minus the variable DOWNPAY and then multiply the result by the value of the variable RATE. Divide that value by 12 and add 50:

     calc (((sale-downpay)*rate)/12)+50 
See Also

Working with Expressions on page 1662 for information on debugger expressions

DELETE

Deletes breakpoints or the watch status of variables in the DATA step

Category: Manipulating Debugging Requests

Alias: D

Syntax

DELETE BREAK location

DELETE WATCH variable(s) _ALL_

Arguments

BREAK

  • deletes breakpoints.

  • Alias: B

location

  • specifies a breakpoint location to be deleted. Location can have one of these values:

    _ALL_

    all current breakpoints in the DATA step.

    label

    the statement after a statement label.

    line-number

    the number of a program line.

    *

    the breakpoint from the current line.

WATCH

  • deletes watched status of variables.

  • Alias: W

variable

  • names one or more watched variables for which the watch status is deleted.

_ALL_

  • specifies that the watch status is deleted for all watched variables.

Examples
  • Delete the breakpoint at the statement label

     eoflabel  :  d b eoflabel 
  • Delete the watch status from the variable ABC in the current DATA step:

     d w abc 

DESCRIBE

Displays the attributes of one or more variables

Category: Manipulating DATA Step Variables

Alias: DESC

Syntax

DESCRIBE variable(s) _ALL_

Arguments

variable

  • identifies a DATA step variable.

_ALL_

  • indicates all variables that are defined in the DATA step.

Details

The DESCRIBE command displays the attributes of one or more specified variables.

DESCRIBE reports the name, type, and length of the variable, and, if present, the informat, format, or variable label.

Examples
  • Display the attributes of variable ADDRESS:

     desc address 
  • Display the attributes of array element ARR{ i + j }:

     desc arr{  i  +  j  } 

ENTER

Assigns one or more debugger commands to the ENTER key

Category: Tailoring the Debugger

Syntax

ENTER < command-1 <... ; command-n >>

Arguments

command

  • specifies a debugger command.

  • Default: STEP 1

Details

The ENTER command assigns one or more debugger commands to the ENTER key. Assigning a new command to the ENTER key replaces the existing command assignment. If you assign more than one command, separate the commands with semicolons.

Examples
  • Assign the command STEP 5 to the ENTER key:

     enter st 5 
  • Assign the commands EXAMINE and DESCRIBE, both for the variable CITY, to the ENTER key:

     enter ex city; desc city 

EXAMINE

Displays the value of one or more variables

Category: Manipulating DATA Step Variables

Alias: E

Syntax

EXAMINE variable-1 < format-1 > <... variable-n < format-n >>

EXAMINE _ALL_ < format >

Arguments

variable

  • identifies a DATA step variable.

format

  • identifies a SAS format or a user-created format.

_ALL_

  • identifies all variables that are defined in the current DATA step.

Details

The EXAMINE command displays the value of one or more specified variables. The debugger displays the value using the format currently associated with the variable, unless you specify a different format.

Examples
  • Display the values of variables N and STR:

     ex n str 
  • Display the element i of the array TESTARR:

     ex testarr{  i  } 
  • Display the elements i +1, j *2, and k -3 of the array CRR:

     ex crr{  i  +1}; ex crr{  j  *2}; ex crr{  k  3} 
  • Display the SAS date variable T_DATE with the DATE7. format:

     ex t_date date7. 
  • Display the values of all elements in array NEWARR:

     ex newarr{  *  } 
See Also

Command:

GO

Starts or resumes execution of the DATA step

Category: Controlling Program Execution

Alias: G

Syntax

GO < line-number label >

Without Arguments

If you omit arguments, GO resumes execution of the DATA step and executes its statements continuously until a breakpoint is encountered , until the value of a watched variable changes, or until the DATA step completes execution.

Arguments

line-number

  • gives the number of a program line at which execution is to be suspended next.

label

  • is a statement label. Execution is suspended at the statement following the statement label.

Details

The GO command starts or resumes execution of the DATA step. Execution continues until all observations have been read, a breakpoint specified in the GO command is reached, or a breakpoint set earlier with a BREAK command is reached.

Examples
  • Resume executing the program and execute its statements continuously:

     g 
  • Resume program execution and then suspend execution at the statement in line 104:

     g 104 

HELP

Displays information about debugger commands

Category: Controlling the Windows

Syntax

HELP

Without Arguments

The HELP command displays a directory of the debugger commands. Select a command name to view information about the syntax and usage of that command. You must enter the HELP command from a window command line, from a menu, or with a function key.

JUMP

Restarts execution of a suspended program

Category: Controlling Program Execution

Alias: J

Syntax

JUMP line-number label

Arguments

line-number

  • indicates the number of a program line at which to restart the suspended program.

label

  • is a statement label. Execution resumes at the statement following the label.

Details

The JUMP command moves program execution to the specified location without executing intervening statements. After executing JUMP, you must restart execution with GO or STEP. You can jump to any executable statement in the DATA step.

CAUTION:

  • Do not use the JUMP command to jump to a statement inside a DO loop or to a label that is the target of a LINK-RETURN group. In such cases you bypass the controls set up at the beginning of the loop or in the LINK statement, and unexpected results can appear.

    JUMP is useful in two situations:

  • when you want to bypass a section of code that is causing problems in order to concentrate on another section. In this case, use the JUMP command to move to a point in the DATA step after the problematic section.

  • when you want to re-execute a series of statements that have caused problems. In this case, use JUMP to move to a point in the DATA step before the problematic statements and use the SET command to reset values of the relevant variables to the values they had at that point. Then re-execute those statements with STEP or GO.

Examples
  • Jump to line 5: j 5

LIST

Displays all occurrences of the item that is listed in the argument

Category: Manipulating Debugging Requests

Alias: L

Syntax

LIST _ALL_ BREAK DATASETS FILES INFILES WATCH

Arguments

_ALL_

  • displays the values of all items.

BREAK

  • displays breakpoints.

  • Alias: B

DATASETS

  • displays all SAS data sets used by the current DATA step.

FILES

  • displays all external files to which the current DATA step writes .

INFILES

  • displays all external files from which the current DATA step reads.

WATCH

  • displays watched variables.

  • Alias: W

Examples
  • List all breakpoints, SAS data sets, external files, and watched variables for the current DATA step:

     l _all_ 
  • List all breakpoints in the current DATA step:

     l b 

QUIT

Terminates a debugger session

Category: Terminating the Debugger

Alias: Q

Syntax

QUIT

Without Arguments

The QUIT command terminates a debugger session and returns control to the SAS session.

Details

SAS creates data sets built by the DATA step that you are debugging. However, when you use QUIT to exit the debugger, SAS does not add the current observation to the data set.

You can use the QUIT command at any time during a debugger session. After you end the debugger session, you must resubmit the DATA step with the DEBUG option to begin a new debugging session; you cannot resume a session after you have ended it.

SET

Assigns a new value to a specified variable

Category: Manipulating DATA Step Variables

Alias: None

Syntax

SET variable = expression

Arguments

variable

  • specifies the name of a DATA step variable or an array reference.

expression

  • is any debugger expression.

  • Tip: Expression can contain the variable name that is used on the left side of the equal sign. When a variable appears on both sides of the equal sign, the debugger uses the original value on the right side to evaluate the expression and stores the result in the variable on the left.

Details

The SET command assigns a value to a specified variable. When you detect an error during program execution, you can use this command to assign new values to variables. This enables you to continue the debugging session.

Examples
  • Set the variable A to the value of 3:

     set a=3 
  • Assign to the variable B the value

    12345 concatenated with the previous value of B:

     set b='12345'  b 
  • Set array element ARR{1} to the result of the expression a+3:

     set arr{1}=a+3 
  • Set array element CRR{1,2,3} to the result of the expression crr{1,1,2} + crr{1,1,3}:

     set crr{1,2,3} = crr{1,1,2} + crr{1,1,3} 
  • Set variable A to the result of the expression a+c*3:

     set a=a+c*3 

STEP

Executes statements one at a time in the active program

Category: Controlling Program Execution

Alias: ST

Syntax

STEP < n >

Without Arguments

STEP executes one statement.

Arguments

n

  • specifies the number of statements to execute.

Details

The STEP command executes statements in the DATA step, starting with the statement at which execution was suspended.

When you issue a STEP command, the debugger:

  • executes the number of statements that you specify

  • displays the line number

  • returns control to the user and displays the > prompt.

Note: By default, you can execute the STEP command by pressing the ENTER key.

SWAP

Switches control between the SOURCE window and the LOG window

Category: Controlling the Windows

Alias: None

Syntax

SWAP

Without Arguments

The SWAP command switches control between the LOG window and the SOURCE window when the debugger is running. When you begin a debugging session, the LOG window becomes active by default. While the DATA step is still being executed, the SWAP command enables you to switch control between the SOURCE and LOG window so that you can scroll and view the text of the program and also continue monitoring the program execution. You must enter the SWAP command from a window command line, from a menu, or with a function key.

TRACE

Controls whether the debugger displays a continuous record of the DATA step execution

Category: Manipulating Debugging Requests

Alias: T

Default: OFF

Syntax

TRACE <ON OFF>

Without Arguments

TRACE displays the current status of the TRACE command.

Arguments

ON

  • prepares for the debugger to display a continuous record of DATA step execution. The next statement that resumes DATA step execution (such as GO) records all actions taken during DATA step execution in the DEBUGGER LOG window.

OFF

  • stops the display.

Examples
  • Determine whether TRACE is ON or OFF:

     trace 
  • Prepare to display a record of debugger execution:

     trace on 

WATCH

Suspends execution when the value of a specified variable changes

Category: Manipulating Debugging Requests

Alias: W

Syntax

WATCH variable(s)

Arguments

variable

  • specifies a DATA step variable.

Details

The WATCH command specifies a variable to monitor and suspends program execution when its value changes.

Each time the value of a watched variable changes, the debugger:

  • suspends execution

  • displays the line number where execution has been suspended

  • displays the variable s old value

  • displays the variable s new value

  • returns control to the user and displays the > prompt.

Examples
  • Monitor the variable DIVISOR for value changes:

     w divisor 



SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net