DNUM Function


Returns the number of members in a directory

Category: External Files

Syntax

DNUM ( directory-id )

Argument

directory-id

  • specifies the identifier that was assigned when the directory was opened, generally by the DOPEN function.

Details

You can use DNUM to determine the highest possible member number that can be passed to DREAD.

Examples

Example 1: Using DNUM to Return the Number of Members

This example opens the directory MYDIR, determines the number of members, and closes the directory:

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

Example 2: Using DNUM within a DATA Step

This example creates a DATA step that returns the number of members in a directory called MYDIR:

 data _null_;     rc=filename("mydir","  physical-name  ");     did=dopen("mydir");     memcount=dnum(did);     rc=dclose(did);  run; 

See Also

Functions:

  • 'DOPEN Function' on page 503

  • 'DREAD Function' on page 507




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