Sample 24637: Return file information with the FINFO function
Retrieve available external file information.
Note:
FINFO returns the value of a system-dependent information
item for an external file. FINFO returns a blank if the
value given for info-item is invalid.
This program assigns a fileref using the FILENAME
function, opens the external file and determines the
amount of information available about the file.
The information available on files depends on the
operating environment. Some host companions contain a
table describing the information available.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/* Replace c:\temp\rawdata.txt in the statement below with the fully */
/* qualified path of the file. The path must be quoted as it is below. */
%let path='c:\temp\rawdata.txt';
data info;
length infoname infoval $60;
rc=filename("foo","&path");
fid=fopen("foo");
/* FOPTNUM determines the number of system-dependent information */
/* items available. */
infonum=foptnum(fid);
do i=1 to infonum;
/* FOPTNAME determines the names of the available file */
/* information items. */
infoname=foptname(fid,i);
infoval=finfo(fid,infoname);
output;
end;
close=fclose(fid);
keep infoname infoval;
run;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs infoname infoval
1 File Name c:\temp\rawdata.txt
2 RECFM V
3 LRECL 256
Retrieve available external file information.
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step SAS Reference ==> Functions ==> External Files
|
| Date Modified: | 2005-12-16 03:02:55 |
| Date Created: | 2004-09-30 14:09:00 |
Operating System and Release Information
| SAS System | Base SAS | All | 6.12 | n/a |