Usage Note 38267: Retrieving the file ID and other file information using the FINFO function in SAS® 9.2.
In SAS 9.2, the FINFO function (in conjunction with the FOPEN and FCLOSE functions) retrieves system information from a file. You provide the file ID (that is assigned when the file is opened with the FOPEN function) and the name of the file information item that you want to retrieve, as shown in the following syntax:
FINFO(file-id,info-item)
The available information items (or, attributes) depend on the operating environment and the SAS release. If you do not know the available attributes, you can use the FOPTNUM and FOPTNAME functions to identify those attributes for use with the FINFO function.
The following example uses all five functions (FOPEN, FOPTNUM, FOPTNAME, FINFO, and FCLOSE) to retrieve available attributes and their values. Of course, you can simplify the program if you already know which attributes (for example, File Size(bytes) or Last Modified) that you want to retrieve.
data info;
length infoname infoval $60;
drop rc fid infonum i close;
rc=filename("abc","c:\temp\mon3.dat");
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;
proc print data=info;
title1 "Attributes obtained for a file";
run;
In a Windows operating environment, the output appears as follows:
infoname infoval
Filename c:\temp\mon3.dat
RECFM V
LRECL 256
File Size (bytes) 332
Last Modified 05May2009:10:44:23
Create Time 04May2009:17:04:22
Output from same program run in SAS® 9.1.3 (fewer attributes are available – not very useful):
infoname infoval
File Name c:\temp\mon3.dat
RECFM V
LRECL 256
Operating System and Release Information
SAS System | Base SAS | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows XP 64-bit Edition | 9.21 | | 9.2 TS2M3 | |
Microsoft® Windows® for x64 | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Standard Edition | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows Server 2008 | 9.21 | | 9.2 TS2M3 | |
Microsoft Windows XP Professional | 9.21 | | 9.2 TS2M3 | |
Windows 7 Enterprise 32 bit | 9.21 | | 9.2 TS2M3 | |
Windows 7 Enterprise x64 | 9.21 | | 9.2 TS2M3 | |
Windows 7 Home Premium 32 bit | 9.21 | | 9.2 TS2M3 | |
Windows 7 Home Premium x64 | 9.21 | | 9.2 TS2M3 | |
Windows 7 Professional 32 bit | 9.21 | | 9.2 TS2M3 | |
Windows 7 Professional x64 | 9.21 | | 9.2 TS2M3 | |
Windows 7 Ultimate 32 bit | 9.21 | | 9.2 TS2M3 | |
Windows 7 Ultimate x64 | 9.21 | | 9.2 TS2M3 | |
Windows Vista | 9.21 | | 9.2 TS2M3 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Date Modified: | 2010-01-08 15:40:02 |
Date Created: | 2009-12-23 15:17:50 |