SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3

DREAD Function

Returns the name of a directory member

Category: External Files

Syntax

DREAD ( directory-id , nval )

Arguments

directory-id

nval

Details

DREAD returns a blank if an error occurs (such as when nval is out-of-range). Use DNUM to determine the highest possible member number that can be passed to DREAD.

Examples

This example opens the directory identified by the fileref MYDIR, retrieves the number of members , and places the number in the variable MEMCOUNT. It then retrieves the name of the last member, places the name in the variable LSTNAME , and closes the directory:

%let filrf=mydir; %let rc=%sysfunc(filename(filrf, physical-name )); %let did=%sysfunc(dopen(&filrf)); %let lstname=; %let memcount=%sysfunc(dnum(&did)); %if &memcount > 0 %then %let lstname=%sysfunc(dread(&did,&memcount)); %let rc=%sysfunc(dclose(&did));

See Also

Functions:

Категории