Closes a SAS data set
Category: SAS File I/O
CLOSE ( data-set-id )
data-set-id
specifies the data set identifier that the OPEN function returns.
CLOSE returns 0 if the operation was successful, ‰ 0 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.
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));
This example opens the SAS data set MYDATA within a DATA step. MYDATA is closed automatically at the end of the DATA step. You do not need to use CLOSE to close the file.
data _null_; dsid=open('mydata','i'); if dsid > 0 then do; ...more statements... end; run;
Function:
'OPEN Function' on page 690