DINFO Function: Windows

Returns information about a directory.

Category: External Files
Windows specifics: directory pathname is the only information available
See: DINFO Function in SAS Functions and CALL Routines: Reference

Syntax

Required Arguments

directory-id

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

info-item

specifies the information item to be retrieved. DINFO returns a blank if the value of info-item is invalid.

Details

Directories that are opened with the DOPEN function are identified by a directory–id. Use DOPTNAME to determine the names of the available system–dependent directory information items. Use DOPTNUM to determine the number of directory information items available.
Under Windows, the only info-item that is available is Directory, which is the pathname of directory-id. If directory-id points to a list of concatenated directories, then Directory is the list of concatenated directory names.

Example: Obtaining Directory Information

data a;
  rc=filename("tmpdir", "c:");
  put "rc = 0 if the directory exists: " rc=;
  did=dopen("tmpdir“);
  put did=;
  numopts=doptnum(did);
  put numopts=;
  do i = 1 to numopts;
    optname = doptname(did,i);
    put i= optname=;
    optval=dinfo(did,optname);
    put optval=;
  end;
run;
The SAS Log Displays the Directory Information
NOTE: PROCEDURE PRINTTO used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds
446  data a;
447    rc=filename("tmpdir", "c:");
448    put "rc = 0 if the directory exists: " rc=;
449    did=dopen("tmpdir");
450    put did=;
451    numopts=doptnum(did);
452    put numopts=;
453    do i = 1 to numopts;
454      optname = doptname(did,i);
455      put i= optname=;
456      optval=dinfo(did,optname);
457      put optval=;
458    end;
459  run;
rc = 0 if the directory exists: rc=0
did=1
numopts=1
i=1 optname=Directory
optval=C:\TEMP\elimal
NOTE: The data set WORK.A has 1 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.04 seconds
460  proc printto; run;