SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 48147: Variables read using SET, MERGE, and UPDATE statements are automatically retained

DetailsCodeOutputAboutRate It

Variables that are read by the SET, MERGE, and UPDATE statements are automatically retained between iterations of the data step. Variables that are created in the data set are not automatically retained and need the RETAIN statement if that behavior is desired.

The sample code provided shows the difference in retention between variables that are read from a data set and variables that are created within the data step. When the Program Data Vector (PDV) is created at compile time, variables that are read from a data set are marked for retention. That action holds true even if that variable is not read for a particular observation. Variables that are read from a data set are initialized to missing upon change of a by-group. Variables that are created within the data step are initialized to missing at the start of each iteration of the data step.

For more information, please see the section titled Data Step Processing in the SAS Language Reference: Concepts documentation.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASAster Data nCluster on Linux x64
DB2 Universal Database on AIX
DB2 Universal Database on Linux x64
Greenplum on Linux x64
Netezza TwinFin 32bit blade
Netezza TwinFin 32-bit SMP Hosts
Netezza TwinFin 64-bit S-Blades
Netezza TwinFin 64-bit SMP Hosts
Teradata on Linux
z/OS
Z64
OpenVMS VAX
Microsoft® Windows® for 64-Bit Itanium-based Systems
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows XP 64-bit Edition
Microsoft® Windows® for x64
OS/2
Microsoft Windows 8 Pro
Microsoft Windows 95/98
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Server
Microsoft Windows 2000 Professional
Microsoft Windows NT Workstation
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2008
Microsoft Windows Server 2008 for x64
Microsoft Windows Server 2012
Microsoft Windows XP Professional
Windows 7 Enterprise 32 bit
Windows 7 Enterprise x64
Windows 7 Home Premium 32 bit
Windows 7 Home Premium x64
Windows 7 Professional 32 bit
Windows 7 Professional x64
Windows 7 Ultimate 32 bit
Windows 7 Ultimate x64
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
* 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.