BookmarkSubscribeRSS Feed
yabwon
Amethyst | Level 16

Hey SAS communities,

 

I'm sharing for your awareness before you decide to migrate to SAS 9.4 M9!

 

My SAS kicked me in the face today:

1 data _null_;
2 x=42;
3 a = ADDRLONG(x);
4 z = PEEKLONG(a, 8);
5 put x= a= z=;
6 run;

ERROR: The ADDRLONG function is not available beginning with SAS 9.4M9.
ERROR: The PEEKLONG function is not available beginning with SAS 9.4M9.
x=42 a= z=.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

 

The documentation says:

"Starting in 9.4M9, the ADDRLONG/PEEKLONG function is removed from SAS as a security precaution. The function is no longer supported and should not be used. This function should be removed from DATA step programs to prevent an error."

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n17rdcklnhb7xjn1l4phv0v35d0g.h...

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



8 REPLIES 8
yabwon
Amethyst | Level 16

One more snippet and its results in M8 and M9:

Code:

data _null_;
  x="42";
  a = ADDRLONG(x);
  length z $2;
  z = PEEKcLONG(a,2);
  put a=hex16. / (x z) (/=binary64.)
  (x z) (/=);
run;

M8 log:

 1          %put &sysvlong4.;
 9.04.01M8P02222023
 2          data _null_;
 3            x="42";
 4            a = ADDRLONG(x);
 5            length z $2;
 6            z = PEEKcLONG(a,2);
 7            put a=hex16. / (x z) (/=binary64.)
 8            (x z) (/=);
 9          run;
 
 a=080182541B7F0000
 x=0011010000110010
 z=0011010000110010
 x=42
 z=42
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds

M9 log:

1    %put &sysvlong4.;
9.04.01M9P06042025
2    data _null_;
3      x="42";
4      a = ADDRLONG(x);
5      length z $2;
6      z = PEEKcLONG(a,2);
7      put a=hex16. / (x z) (/=binary64.)
8      (x z) (/=);
9    run;

ERROR: The ADDRLONG function is not available beginning with SAS 9.4M9.
ERROR: The PEEKCLONG function is not available beginning with SAS 9.4M9.
a=2020202020202020

x=0011010000110010
z=0010000000100000
x=42
z=
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Quentin
Super User

This is very surprising, and disappointing.  Since an admin could already make these functions unavailable by configuring SAS sessions to run in "lockdown mode," I'm surprised SAS would completely remove the functions.

 

The What's New has a list of the functions removed in M9.  In addition to the variations of ADDR, PEEK, and POKE, we also lost the MODULE functions.

 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/whatsnew/n14c8glgh3j7hxn1b1byjs3sqnvz.htm#n0f...

 

yabwon
Amethyst | Level 16

Thanks for the link Quentin!

It says: "These functions were removed from SAS software for security reasons", but  I don't understand those decisions... I see no justification...

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



ballardw
Super User

@yabwon wrote:

Thanks for the link Quentin!

It says: "These functions were removed from SAS software for security reasons", but  I don't understand those decisions... I see no justification...

 

Bart


In 1979 I watched a fellow computer programming student use similar functions on an HP3000 from a student account give his account system admin abilities. Took him about 5 minutes.  

He did really understand the system very well and ended up working at Hewlett Packard before graduating as a software engineer.

 

yabwon
Amethyst | Level 16

As phrase attributed to Linus Torvalds says: "If you know the system well enough, you can do things that aren't supposed to be possible."

 

The justification used in the documentation, saying: "These functions were removed from SAS software for security reasons" follows the same logic as: "Hammers should be restricted, because they can smash user's finger or other person knee..." 😄

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



hashman
Ammonite | Level 13

Quentin:

Yes, it is, particularly for yours truly. And for quite a few folks who will find out that their production programs no longer work, especially my clients, both  former and current.

So, now the once famous SAS backward compatibility is out the window - following the cadre who had made SAS what it was. I wonder what SAS flowers this mower will cut next under the pretext of cutting weeds.  

 

Best

Paul D.

 

SASKiwi
PROC Star

@hashman @yabwon - Personally I've never found the need to use these memory manipulation functions. What use cases benefit from these?

hashman
Ammonite | Level 13

Hi @SASKiwi:

Have you read any of my papers on the subject? For example:

https://support.sas.com/resources/papers/proceedings09/010-2009.pdf

I'm not sure this was the latest but it should suffice.

 

One real-life use case (from my own experience) is described on page 17. As I recall, in that case using the APP function to move the data in blocks instead of one array item at a time resulted in the reduction of CPU time usage (which mattered since it was on the mainframe, and CPU time usage meant a lot of moolah) by about two orders of magnitude [sic].

 

I'd also add that using these functions is quite paramount in "character" bitmap search from the standpoint of performance if one wants to use every bit of the bitmap to reduce memory footprint (with a "numeric" bitmap, only the mantissa of each numeric array item can be used, i.e. 53 or 56 out of 64 bits, depending on the OS). If you have time and inspiration, you can find why here:

https://support.sas.com/resources/papers/proceedings19/3101-2019.pdf

on page 13 and on.

 

Kind regards

Paul D.   

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 269 views
  • 14 likes
  • 5 in conversation