![]() Chapter Contents |
![]() Previous |
![]() Next |
| GO TO |
| Valid: | in a DATA step |
| Category: | Control |
| Type: | Executable |
| Alias: | GOTO |
| Syntax | |
| Arguments | |
| Comparisons | |
| Examples | |
| See Also |
Syntax |
| GO TO label; |
| Comparisons |
GO TO statements can often be replaced by DO-END and IF-THEN/ELSE programming logic.
| Examples |
Use the GO TO statement as shown here.
data info; input x; if 1<=x<=5 then go to add; put x=; add: sumx+x; datalines; 7 6 323 ;
Because every DATA step contains an implied RETURN at the end of the step, program execution returns to the top of the step after the sum statement is executed. Therefore, an explicit RETURN statement at the bottom of the DATA step is not necessary.
data info;
input x;
if 1<=x<=5 then go to add;
put x=;
return;
/* SUM statement not executed */
/* if x<1 or x>5 */
add: sumx+x;
datalines;
7
6
323
;
| See Also |
| Statements:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.