CLOSE Function


Closes a SAS data set

Category: SAS File I/O

Syntax

CLOSE ( data-set-id )

Arguments

data-set-id

  • specifies the data set identifier that the OPEN function returns.

Details

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.

Examples

  • 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; 

See Also

Function:

  • 'OPEN Function' on page 690




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net