Problem Note 48146: Example for INFILE statement is incorrect in SAS Companion for Windows
The SAS Companion for Windows has an example showing how to list multiple files in an INFILE statement. It is incorrect. SAS requires another set of quotation marks around the parentheses. In this example, since single quotation marks are used around the file names, double quotation marks should be used around the entire string. That can be reversed.
The documentation shows this incorrect syntax.
data new;
infile ('c:\myfiles\*.*','c:\myotherfiles\abc.dat');
input;
run;
The correct syntax is
data new;
infile "('c:\myfiles\*.*','c:\myotherfiles\abc.dat')";
input;
run;
If you use the incorrect syntax, you may get an ERROR in your log:
1562 infile ('c:\testin\*.*','c:\temp\testthis.txt');
-
22
76
ERROR: Undeclared array referenced: infile.
ERROR 22-322: Syntax error, expecting one of the following: +, =.
ERROR 76-322: Syntax error, statement will be ignored.
Operating System and Release Information
SAS System | Base SAS | Microsoft® Windows® for x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows Server 2003 for x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows Server 2008 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows Server 2008 for x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Microsoft Windows XP Professional | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Enterprise 32 bit | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Enterprise x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Home Premium 32 bit | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Home Premium x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Professional 32 bit | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Professional x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Ultimate 32 bit | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows 7 Ultimate x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows Vista | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
Windows Vista for x64 | 9.3 | 9.4 | 9.3 TS1M2 | 9.4 TS1M0 |
*
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.
Type: | Problem Note |
Priority: | medium |
Topic: | Common Programming Tasks ==> Reading and Writing External Data ==> Multiple Files Common Programming Tasks ==> Reading and Writing External Data
|
Date Modified: | 2013-04-04 15:26:02 |
Date Created: | 2012-10-13 11:58:47 |