DOPEN Function


DOPEN Function

Opens a directory and returns a directory identifier value

Category: External Files

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

Syntax

DOPEN ( fileref )

Argument

fileref

  • specifies the fileref assigned to the directory.

  • Restriction: You must associate a fileref with the directory before calling DOPEN.

Details

DOPEN opens a directory and returns a directory identifier value (a number greater than 0) that is used to identify the open directory in other SAS external file access functions. If the directory could not be opened, DOPEN returns 0. The directory to be opened must be identified by a fileref. You can assign filerefs using the FILENAME statement or the FILENAME external file access function. Under some operating environments, you can also assign filerefs using system commands.

Operating Environment Information: The term directory used in the description of this function and related SAS external file access functions refers to an aggregate grouping of files managed by the operating environment. Different operating environments identify such groupings with different names , such as directory, subdirectory, MACLIB, or partitioned data set. For details, see the SAS documentation for your operating environment.

Examples

Example 1: Using DOPEN to Open a Directory

This example assigns the fileref MYDIR to a directory. It uses DOPEN to open the directory. DOPTNUM determines the number of system-dependent directory information items available, and DCLOSE closes the directory:

 %let filrf=MYDIR;  %let rc=%sysfunc(filename(filrf,  physical-name  ));  %let did=%sysfunc(dopen(&filrf));  %let infocnt=%sysfunc(doptnum(&did));  %let rc=%sysfunc(dclose(&did)); 

Example 2: Using DOPEN within a DATA Step

This example opens a directory for processing within a DATA step.

 data _null_;     drop rc did;     rc=filename("mydir","  physical-name  ");     did=dopen("mydir");     if did > 0 then do;        ...  more statements  ...     end;  run; 

See Also

Functions:

  • 'DCLOSE Function' on page 484

  • 'DOPTNUM Function' on page 506

  • 'FOPEN Function' on page 550

  • 'MOPEN Function' on page 656




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