Previous Page | Next Page

Using SCL with Other SAS Software Products

Using SAS DATA Step Features in SCL Programs

SCL supports the syntax of the SAS DATA step with the exceptions and additions noted. Refer to SAS Language Reference: Dictionary for details about the SAS language elements that are available in the DATA step.

SCL does not support the DATA step statements that relate specifically to creating SAS data tables, such as the DATA, SET, INFILE, and DATALINES statements. However, SCL does provide special functions that can perform equivalent SAS table manipulations. See Using SAS Tables for details.


Statements

SCL Elements by Category lists the statements that are supported by SCL and tells you where they are documented. The ARRAY, DO, LENGTH, PUT, and SELECT statements are different in SCL. The differences are documented in their entries in SAS Component Language Dictionary. The following list shows the DATA step statements that are valid in SCL programs and notes differences between a statement's support in SCL and in the DATA step.

ARRAY (Explicit)

defines the elements of an explicit array. _NUMERIC_, _CHARACTER_, and _ALL_ are not supported.

assignment

assigns values to variables.

comment

documents the purpose of a program.

CONTINUE

stops the processing of the current DO loop and resumes with the next iteration of that DO loop. See the dictionary entries for DO as well as CONTINUE for information about the differences in the behavior of this statement in SCL.

DO, iterative DO, DO-UNTIL, DO-WHILE

repetitively execute one or more statements. SCL does not support the DO-list form of the DO statement, but it does support LEAVE and CONTINUE statements that extend the capabilities of DO-group processing.

END

designates the end of a DO group or SELECT group.

GOTO

jumps to a specified program label.

IF-THEN-ELSE

enables conditional execution of one or more statements.

%INCLUDE

accesses statements (usually from an external file) and adds them to the program when the SCL program compiles.

LEAVE

stops executing the current DO group and resumes with the next sequential statement. See the dictionary entries for DO as well as LEAVE for information about the differences in the behavior of this statement in SCL.

LENGTH

allocates storage space for character and numeric variables. In SCL, the LENGTH statement can set only the lengths of nonwindow variables.

LINK

jumps to a specified program label but allows a return to the following statement. SCL allows nesting of up to 25 LINK statements.

NULL

is an executable statement that contains a semicolon (;) and acts as a place holder.

PUT

writes text to the LOG window.

RETURN

returns control or a value to the calling routine or application. In SCL, RETURN can also return a value from the execution of a method.

RUN

is an alias for the RETURN statement.

SELECT-WHEN

enables conditional execution of one or several statements or groups of statements.

STOP

is an alias for the RETURN statement.

SUM

adds the result of an expression to an accumulator variable.


Functions

The following list notes differences between a function's support in SCL and in the DATA step.

DIF

Not supported in SCL.

LAG

Not supported in SCL.

SUM

SCL does not support the colon modifier in the SUM function that is used to sum all variables that start with a certain string.

See SAS Language Reference: Dictionary for details about other DATA step functions that are supported by SCL.


Variables

Variables in SCL programs share most of the characteristics of variables in the DATA step such as default length and type. However, you should be aware of the differences described in the following sections. In addition, SCL variables can be declared to be local in scope to a DO or SELECT block.


Numeric Variables

A variable is assigned the numeric data type if its data type is not explicitly declared.


Character Variables

In SCL, the length of a character variable is determined as follows:


Expressions

SCL supports the standard DATA step expressions in an identical manner. The only exception is the IN operator, which has the following syntax:

i=variable IN (list-of-values)|array-name;

In SCL, the IN operator returns the index of the element if a match is found, or it returns 0 if no match is found. However, in the DATA step, the IN operator returns 1 if a match is found and 0 if no match is found. The IN operator is valid for both numeric and character lists as well as for arrays. If a list that is used with the IN operator contains values with mixed data types, then those values are converted to the data type of the first value in the list when the program is compiled.

In the following example, the statements using the IN operator are equivalent:

array list{3}$ ('cat','bird','dog');
i='dog' in ('cat','bird','dog');
i='dog' in list;

In SCL, this example produces I=3, whereas in the DATA step the example produces I=1. Also, the DATA step does not support the form i='dog' in list .

Previous Page | Next Page | Top of Page