CLOSE Function

Closes a SAS data set.

Category: SAS File I/O

Syntax

CLOSE(data-set-id)

Required Argument

data-set-id

is a numeric variable that specifies the data set identifier that the OPEN function returns.

Details

CLOSE returns zero if the operation was successful, or returns a non-zero value if it was not successful. Close all SAS data sets as soon as they are no longer needed by the application.
Note: All data sets opened within a DATA step are closed automatically at the end of the DATA step.

Example

This example uses OPEN to open the SAS data set PAYROLL. If the data set opens successfully, indicated by a positive value for the variable PAYID, the example uses CLOSE to close the data set.
%let payid=%sysfunc(open(payroll,is));
   macro statements
%if &payid > 0 %then 
   %let rc=%sysfunc(close(&payid));

See Also

Functions: