FINFO Function

Returns the value of a file information item.

Category:External Files
Note:FINFO returns the value of a system-dependent information item for an external file. FINFO returns a blank if the value given for information-item is invalid.

Syntax

Required Arguments

file-id

is a numeric constant, variable, or expression that specifies the identifier that was assigned when the file was opened, generally by the FOPEN function.

information-item

is a character constant, variable, or expression that specifies the name of the file information item to be retrieved.

  • Create Time: ddmmmyyyy:hh:mm:ss
    Note: The Create Time date/time information item is localized to the site's locale. The date/time format might appear slightly different in the locale.
  • Last Modified: ddmmmyyyy:hh:mm:ss
  • Filename
  • File size (bytes)
  • RECFM
  • LRECL

Information-item for pipe files can be one of these file information items:

  • Unnamed pipe access device
  • PROCESS
  • RECFM
  • LRECL
Linux Specifics: Information-item for disk files can have one of the following values:
  • Filename
  • Owner Name
  • Group Name
  • Access Permission
  • Last Modified
  • File Size (bytes)

If you concatenate filenames, then an additional information-item, File List, is available.

If you are using pipe files, then the only valid value for information-item is PIPE Command.

Comparisons

  • The FOPTNAME function determines the names of the available file information items.
  • The FOPTNUM function determines the number of system-dependent information items that are available.

Examples

Example 1

This example stores information items about an external file in a SAS data set:

data info;
   length infoname infoval $60;
   drop rc fid infonum i close;
   rc=filename('abc', 'physical-filename');
   fid=fopen('abc');
   infonum=foptnum(fid);
   do i=1 to infonum;
      infoname=foptname(fid, i);
      infoval=finfo(fid, infoname);
      output;
   end;
   close=fclose(fid);
run;

Example 2: Linux

This example shows the information items available for Linux System Services files:

data _null_;
   length opt $100 optval $100;
   /* Allocate file  */
   rc=FILENAME('myfile',
      '/u/userid/one');
   /* Open file */
   fid=FOPEN('myfile');
   /* Get number of information
      items */
   infocnt=FOPTNUM(fid);
   /* Retrieve information items
      and print to log */
   put @1 'Information for a UNIX System Services File:';
   do j=1 to infocnt;
      opt=FOPTNAME(fid,j);
      optval=FINFO(fid,upcase(opt));
      put @1 opt @20 optval;
   end;
   /* Close the file */
   rc=FCLOSE(fid);
   /* Deallocate the file */
   rc=FILENAME('myfile');
run;
Information for a LINUX
   System Services File:
File Name          /u/userid/one
Access Permission  -rw-rw-rw-
Number of Links    1
Owner Name         USERID
Group Name         GRP
File Size          4
Last Modified      13Jun2017:09:37:02
Created            Mar 16 09:55
NOTE: The DATA statement used
0.07 CPU seconds and 5227K.

See Also

Last updated: April 14, 2026