SAS Component Language Dictionary |
Category: | Directory |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
name=DREAD(directory-id,member-num); |
contains either the name of the member, or a blank if an error occurs (for example, if nval is out-of-range).
contains the identifier that was assigned when the directory was opened. If directory-id is invalid, the program halts.
Details |
Use DNUM to determine the highest possible member number that can be passed to DREAD. DREAD works only if the directory was previously opened by the DOPEN function.
Example |
Open the directory identified by the fileref MYDIR, retrieve the number of members and place the number in the variable MEMCOUNT, retrieve the name of the last member and place the name in the variable LSTNAME, and then close the directory:
/* Assign the fileref MYDIR to the */ /* filename stored in the variable DIRNAME */ /* and open it. */ rc=filename('mydir',dirname); dirid=dopen('mydir') lstname=''; memcount=dnum(dirid); if (memcount>0) then lstname=dread(dirid,memcount); rc=dclose(dirid);
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.