PEEK Function

Stores the contents of a memory address in a numeric variable on a 32-bit platform.

Category: Special
Restriction: Use on 32-bit platforms only.

Syntax

PEEK(address<,length> )

Required Argument

address

is a numeric constant, variable, or expression that specifies the memory address.

Optional Argument

length

is a numeric constant, variable, or expression that specifies the data length.

Default a 4-byte address pointer
Range 2–8

Details

If you do not have access to the memory storage location that you are requesting, the PEEK function returns an "Invalid argument" error.
You cannot use the PEEK function on 64-bit platforms. If you attempt to use it, SAS writes a message to the log stating that this restriction applies. If you have legacy applications that use PEEK, change the applications and use PEEKLONG instead. You can use PEEKLONG on both 32–bit and 64–bit platforms.

Comparisons

The PEEK function stores the contents of a memory address into a numeric variable. The PEEKC function stores the contents of a memory address into a character variable.
Note: SAS recommends that you use PEEKLONG instead of PEEK because PEEKLONG can be used on both 32–bit and 64–bit platforms.

Example

The following example, specific to the z/OS operating environment, returns a numeric value that represents the address of the Communication Vector Table (CVT).
data _null_;
      /* 16 is the location of the CVT address */
   y=16; 
   x=peek(y);
   put 'x= ' x hex8.;
run;

See Also

CALL Routines: