Problem Note 38147: Using DSD and DLMSTR= in the INFILE statement does not handle consecutive delimiters correctly
When reading an external file into a SAS data set, the INFILE statement defines the file to be read as well as various options about how to read the file. The DSD option specifies that when data values are enclosed in quotation marks, delimiters within the value are treated as character data. The DSD option changes how SAS treats delimiters when you use LIST input and sets the default delimiter to a comma. When you specify DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values. The DLMSTR option specifies a character string as an alternate delimiter (other than a blank) to be used for LIST input.
The DSD and DLMSTR options in the INFILE statement are not correctly handling consecutive delimiters.
When you use the DSD and DLMSTR= options in the INFILE statement, you would expect consecutive delimiters to create a missing value. Currently, this is not behaving as it should. If your variables are character, you will get a missing value, but the value following will contain a portion of the delimiter. If your variables are numeric, the consecutive delimiters are ignored.
Refer to SAS Note 33385, "DLMSTR= option used to specify multi-character string as a delimiter", for more information about handling multiple delimiters when reading a file.
Operating System and Release Information
SAS System | Base SAS | 64-bit Enabled HP-UX | 9.2 TS2M0 | 9.3 TS1M0 |
64-bit Enabled AIX | 9.2 TS2M0 | 9.3 TS1M0 |
Windows Vista | 9.2 TS2M0 | 9.3 TS1M0 |
Windows Vista for x64 | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows XP Professional | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2008 for x64 | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 for x64 | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft® Windows® for x64 | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | 9.3 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | 9.3 TS1M0 |
z/OS | 9.2 TS2M0 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9.2 TS2M0 | 9.3 TS1M0 |
HP-UX IPF | 9.2 TS2M0 | 9.3 TS1M0 |
Linux | 9.2 TS2M0 | 9.3 TS1M0 |
Linux for x64 | 9.2 TS2M0 | 9.3 TS1M0 |
OpenVMS on HP Integrity | 9.2 TS2M0 | 9.3 TS1M0 |
Solaris for x64 | 9.2 TS2M0 | 9.3 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.
Here is code that demonstrates the problem.
data one;
infile cards dlmstr='||' dsd;
input a $ b $ c $ ;
/* input a b c; */
cards;
123||||4
;
run;
proc print;
run;
If your variables are numeric, your output will be:
Obs a b c
1 123 . .
If your varialbes are character, your output will be:
Obs a b c
1 123 |4
Type: | Problem Note |
Priority: | medium |
Topic: | SAS Reference ==> DATA Step Common Programming Tasks ==> Reading and Writing External Data
|
Date Modified: | 2011-10-05 12:50:16 |
Date Created: | 2009-12-15 10:36:03 |