Problem Note 66121: The items in a multiple-item list do not maintain the same order in which you inserted them when using ordered DATA step hashes
The items in a multiple-item list do not maintain the same order in which you inserted them when using ordered DATA step hashes.
This problem occurs when the MULTIDATA:'YES' argument is specified in the DECLARE HASH statement.
The following code example illustrates the problem, and there is also a line in the comments that provides a workaround:
data _null_;
length state $ 2 city $ 32;
dcl hash h(multidata:'y');
h.definekey('state');
h.definedata('city');
h.definedone();
/* Uncomment the next line for the workaround */
/* if 0 then h.find_prev(); */
state = 'NC'; city = 'Raleigh'; h.add();
state = 'NC'; city = 'Cary'; h.add();
state = 'NC'; city = 'Wilson'; h.add();
state = 'NC'; city = 'Spruce Pine'; h.add();
state = 'NC';
do while (h.do_over() = 0);
put state= city=;
end;
run;
When the code above is run without the workaround, the city names are listed in the output as “Raleigh, Spruce Pine, Wilson, Cary.” You would expect the output to list the items as “Raleigh, Cary, Wilson, Spruce Pine,” which is how you ordered them in the code.
Click the Hot Fix tab in this note for a link to instructions about accessing and applying the software update.
Operating System and Release Information
SAS System | SAS Viya | Linux for x64 | 3.4 | 3.5 | Viya | Viya |
Windows Vista | 3.4 | | Viya | |
Windows Millennium Edition (Me) | 3.4 | | Viya | |
Windows 7 Ultimate x64 | 3.4 | 3.5 | Viya | Viya |
Windows 7 Ultimate 32 bit | 3.4 | | Viya | |
Windows 7 Professional x64 | 3.4 | 3.5 | Viya | Viya |
Windows 7 Home Premium x64 | 3.4 | 3.5 | Viya | Viya |
Windows 7 Home Premium 32 bit | 3.4 | | Viya | |
Windows 7 Enterprise x64 | 3.4 | 3.5 | Viya | Viya |
Windows 7 Enterprise 32 bit | 3.4 | | Viya | |
Microsoft Windows XP Professional | 3.4 | | Viya | |
Microsoft Windows Server 2016 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2012 Std | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2012 R2 Std | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2012 R2 Datacenter | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2012 Datacenter | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2008 for x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2008 R2 | 3.4 | 3.5 | Viya | Viya |
Windows 7 Professional 32 bit | 3.4 | | Viya | |
Windows Vista for x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2019 | 3.4 | | Viya | |
Microsoft® Windows® for x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows 8 Enterprise 32-bit | 3.4 | | Viya | |
Microsoft Windows 8 Enterprise x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows 8 Pro 32-bit | 3.4 | | Viya | |
Microsoft Windows 8 Pro x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows 8.1 Enterprise 32-bit | 3.4 | | Viya | |
Microsoft Windows 8.1 Enterprise x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows 8.1 Pro 32-bit | 3.4 | | Viya | |
Microsoft Windows 8.1 Pro x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows 10 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows 95/98 | 3.4 | | Viya | |
Microsoft Windows 2000 Advanced Server | 3.4 | | Viya | |
Microsoft Windows 2000 Datacenter Server | 3.4 | | Viya | |
Microsoft Windows 2000 Server | 3.4 | | Viya | |
Microsoft Windows 2000 Professional | 3.4 | | Viya | |
Microsoft Windows NT Workstation | 3.4 | | Viya | |
Microsoft Windows Server 2003 Datacenter Edition | 3.4 | | Viya | |
Microsoft Windows Server 2003 Enterprise Edition | 3.4 | | Viya | |
Microsoft Windows Server 2003 Standard Edition | 3.4 | | Viya | |
Microsoft Windows Server 2003 for x64 | 3.4 | 3.5 | Viya | Viya |
Microsoft Windows Server 2008 | 3.4 | | Viya | |
*
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: | high |
Date Modified: | 2020-06-12 09:38:04 |
Date Created: | 2020-06-11 15:41:58 |