Previous Page | Next Page

Acting on Selected Observations

Review of SAS Tools


Statements

IF condition THEN action;
<ELSE action;>

tests whether the condition is true; if so, the action in the THEN clause is carried out. If the condition is false and an ELSE statement is present, then the ELSE action is carried out. If the condition is false and no ELSE statement is present, then the next statement in the DATA step is processed. The condition is one or more numeric or character comparisons. The action must be an executable statement; that is, one that can be processed in an individual iteration of the DATA step. (Statements that affect the entire DATA step, such as LENGTH, are not executable.)

In SAS processing, any numeric value other than 0 or missing is true; 0 and missing are false. Therefore, a numeric value can stand alone in a comparison. If its value is 0 or missing, then the comparison is false; otherwise, the comparison is true.


Functions

INDEX(source,excerpt)

searches the source for the string given in excerpt. Both the source and excerpt can be any kind of character expression, such as character variables, character strings enclosed in quotation marks, other character functions, and so on. When excerpt is present in source, the function returns the position of the first character of excerpt (a positive number). When excerpt is not present, the function returns a 0.

UPCASE(argument)

produces an uppercase value of argument, which can be any kind of character expression, such as character variables, character strings enclosed in quotation marks, other character functions, and so on.

Previous Page | Next Page | Top of Page