FDELETE Function


FDELETE Function

Deletes an external file or an empty directory

Category: External Files

See: FDELETE Function in the documentation for your operating environment.

Syntax

FDELETE ( fileref directory )

Argument

fileref

  • specifies the fileref that you assigned to the external file. You can assign filerefs by using the FILENAME statement or the FILENAME external file access function.

  • Restriction: The fileref that you use with FDELETE cannot be a concatenation.

  • Operating Environment Information: In some operating environments, you can specify a fileref that was assigned with an environment variable. You can also assign filerefs using system commands. For details, see the SAS documentation for your operating environment.

directory

  • specifies an empty directory that you want to delete.

  • Restriction: You must have authorization to delete the directory.

Details

FDELETE returns 0 if the operation was successful or ‰  0 if it was not successful.

Examples

Example 1: Deleting an External File

This example generates a fileref for an external file in the variable FNAME. Then it calls FDELETE to delete the file and calls the FILENAME function again to deassign the fileref.

 data _null_;      fname="tempfile";      rc=filename(fname,"  physical-filename  ");      if rc = 0 and fexist(fname) then         rc=fdelete(fname);      rc=filename(fname);  run; 

Example 2: Deleting a Directory

This example uses FDELETE to delete an empty directory to which you have write access. If the directory is not empty, the optional SYSMSG function returns an error message stating that SAS is unable to delete the file.

 filename testdir '  physical-filename  ';  data _null_;     rc=fdelete('testdir');     put rc=;     msg=sysmsg();     put msg=;  run; 

See Also

Functions:

  • 'FEXIST Function' on page 526

  • 'FILENAME Function' on page 529

Statement:

  • 'FILENAME Statement' on page 1169




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