BookmarkSubscribeRSS Feed
ubange
Calcite | Level 5

hi everybody,

Can someone kindly suggest me why does the following snippet work in its first part and doesn't in its second?

I'm going crazy. Thank you in advance for your appreciated help.

Marco

ps. Sas version: 9.4

*****

data try;

array hkey (0 : 5128933102) _temporary_ ;

 

*this part works;
    hkey(5128077630)=5;
    put hkey(5128077630)=;

 

*this part doesn't work (ERROR: Array subscript out of range);
    i=5128077630;

    hkey(i)=5;
    put hkey(i)=;

 

run;

4 REPLIES 4
Tom
Super User Tom
Super User

Are you sure it works.

I suspect you do not have enough memory to make an array with over 5 BILLION variables in it.

 

PeterClemmensen
Tourmaline | Level 20

Try running this example. I'm going with 101 array elements since +5B i quite memory heavy. Seems to work fine?

 

Can you post the full log for your original run?

 

data try;
   array hkey (0 : 100) _temporary_ ;

   hkey(100)=5;
   put hkey(100)=;

   i=100;
   hkey(i)=100;
   put hkey(i)=;
run;
Tom
Super User Tom
Super User

See how large an array you can make on your system.

%macro test;
%do i=1 %to 10 ;
%let upper=%sysevalf(10**&i);
%let syscc=0;
data try;
  array hkey (0 : &upper) _temporary_ ;
run;
%put &=i &=syscc &=upper;

%end;
%mend;
%test;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 590 views
  • 0 likes
  • 4 in conversation