ADDR Function

Returns the memory address of a variable on a 32-bit platform.

Category:Special
Restrictions:Use on 32-bit platforms only.
This function is not valid on the CAS server.
Interaction:When a SAS server is in a locked-down state, the ADDR function does not execute.

Syntax

ADDR(variable)

Required Argument

variable

specifies a variable name.

Details

The value that is returned is numeric. Because the storage location of a variable can vary from one execution to the next, the value that is returned by ADDR can vary. The ADDR function is used mostly in combination with the PEEK and PEEKC functions and the CALL POKE routine.
If you attempt to use the ADDR function on 64-bit platforms, SAS writes a message to the log stating that this restriction applies. If you have legacy applications that use ADDR, change the applications and use ADDRLONG instead. You can use ADDRLONG on 32-bit and 64-bit platforms.

Comparisons

The ADDR function returns the memory address of a variable on a 32-bit platform. ADDRLONG returns the memory address of a variable on 32-bit and 64-bit platforms.
Note: As a best practice, use ADDRLONG instead of ADDR because ADDRLONG can be used on 32-bit and 64-bit platforms.

Example

This example returns the address at which the variable FIRST is stored.
data numlist;
   first=3;
   x=addr(first);
run;
Last updated: March 16, 2017