<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981745#M6580</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446135"&gt;@Rabelais&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Many thanks for the detailed analysis! So basically are you saying that these lines of code&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%do i=1 %to 1000000;
	b = a;
%end;&lt;/LI-CODE&gt;
&lt;P&gt;are turned into 1000000 lines of text where each line is equal to "b = a;" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The SAS option MPRINT, assuming no syntax problems will show the generated code in the LOG.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;%macro loop;
%do i=1 %to 25;
   %put Loop is &amp;amp;i. ;
%end;
%mend;

options mprint;
%loop&lt;/PRE&gt;
&lt;P&gt;The log will show the result of each %put statement, only 25 in this case. I used that for an example to avoid the errors that would occur with assignments when no data step is present.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turn off the option with :&lt;/P&gt;
&lt;P&gt;options nomprint;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;after the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The options SYMBOLGEN will show the results of creating and combining macro variable values, MLOGIC will show the result of macro logic comparisons such as %if statements.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jan 2026 06:02:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2026-01-09T06:02:27Z</dc:date>
    <item>
      <title>Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981689#M6572</link>
      <description>&lt;P&gt;Hi, I'm using SAS Enterprise Guide version 8.3 Update 3 (8.3.3.181) (64-bit).&lt;/P&gt;
&lt;P&gt;I noticed a strange bug when overwriting a variable thousands of times inside a &lt;STRONG&gt;macro loop &lt;/STRONG&gt;(normal loops don't have this problem). This is just a toy example reproducing the bug, but let's say we need to overwrite a variable ("b" in the following codes) many many times with itself and we have to use a macro loop. Firstly let's see the minimal memory usage (0 iterations/overwrites)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;&lt;BR /&gt;proc iml;&lt;BR /&gt;a = j(1000,1,1);&lt;BR /&gt;b = a;&lt;BR /&gt;quit;&lt;BR /&gt;%mend;&lt;BR /&gt;%test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and this is the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      memory              544.25k
      OS Memory           21088.00k&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By gradually increasing the overwrites we see an increase in the memory usage. With&amp;nbsp;&lt;SPAN data-teams="true"&gt;1 million overwrites&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;
proc iml;
a = j(1000,1,1);
%do i=1 %to 1000000;
	b = a;
%end;
quit;
%mend;
%test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the memory usage is increased by more than 200 times&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      memory              125586.25k
      OS Memory           163680.00k
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this slightly different code and by increasing the overwrites even more&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro loop;
proc iml;
a = j(10000,1,42);
%do i=1 %to 3000000;
	%do j=1 %to 100;
		simulated_loop_&amp;amp;j = a*3;
	%end;
%end;
quit;
%mend;
%loop;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after 50 minutes SAS raised&amp;nbsp;&lt;STRONG&gt;ERROR: Out of memory for symbols. Cannot proceed.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the (truncated) log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1                                         The SAS System              11:26 Monday, January 5, 2026

1          ;*';*";*/;quit;run;
2          OPTIONS LS=99 PS=32767;
3          OPTIONS PAGENO=MIN;
4          %LET _CLIENTTASKLABEL='Program 1';
5          %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project';
6          %LET _CLIENTPROJECTPATH='';
7          %LET _CLIENTPROJECTPATHHOST='';
8          %LET _CLIENTPROJECTNAME='';
9          %LET _SASPROGRAMFILE='';
10         %LET _SASPROGRAMFILEHOST='';
11         
12         ODS _ALL_ CLOSE;
13         OPTIONS DEV=SVG;
14         GOPTIONS XPIXELS=0 YPIXELS=0;
15         %macro HTML5AccessibleGraphSupported;
16             %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;
17         %mend;
18         FILENAME EGHTML TEMP;
19         ODS HTML5(ID=EGHTML) FILE=EGHTML
20             OPTIONS(BITMAP_MODE='INLINE')
21             %HTML5AccessibleGraphSupported
22             ENCODING='utf-8'
23             STYLE=HTMLEncore
24             GPATH=&amp;amp;sasworklocation
25         ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
26         
27         
28         %macro loop;
29         
30         proc iml;
31         
32         a = j(10000,1,42);
33         
34         %do i=1 %to 3000000;
35         	%do j=1 %to 100;
36         		simulated_loop_&amp;amp;j = a*3;
37         	%end;
38         %end;
39         
40         quit;
41         
42         %mend;
43         
44         %loop;
NOTE: IML Ready
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: The internal source spool file has been truncated. Error logging with line and column 
      information might be incomplete until next step boundary.
NOTE: PROCEDURE IML used (Total process time):
      real time           50:16.32
      user cpu time       48:47.31
      system cpu time     1:26.51
      memory              58767352.00k
      OS Memory           67108696.00k
      Timestamp           01/05/2026 02:20:54 PM
      Step Count                        65  Switch Count  5
      
ERROR: Out of memory for symbols. Cannot proceed.
NOTE: Exiting IML.

180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.

truncated (these lines are repeated million of times)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you can see the memory increased to&amp;nbsp;58 GB and then SAS raised the error. The number of symbols is 101 so I don't understand why it raises a "Out of memory for symbols" rather than a "&lt;SPAN data-teams="true"&gt;Unable to allocate sufficient memory&lt;/SPAN&gt;", anyway clearly there is a problem here. Moreover, the last 4 lines of the log are repeated millions of times so this creates a huge logs (I got a 7 GB log with a similar code).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interestingly, there are no memory problems by using normal loops rather than macro loops. The following code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;
proc iml;
a = j(1000,1,1);
do i=1 to 1000000;
	b = a;
end;
quit;
%mend;
%test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;uses&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      memory              561.87k
      OS Memory           21088.00k
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is just slightly greater than the minimal memory usage (544.25k as shown in the first log above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the memory increase an expected behavior or a bug?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 09:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981689#M6572</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2026-01-08T09:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981697#M6573</link>
      <description>&lt;P&gt;What version of SAS are you using? Run&lt;BR /&gt;&lt;STRONG&gt;%put &amp;amp;=SYSVLONG;&lt;/STRONG&gt;&lt;BR /&gt;and post the result from the Log.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 11:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981697#M6573</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2026-01-08T11:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981701#M6574</link>
      <description>SYSVLONG=9.04.01M7P080520</description>
      <pubDate>Thu, 08 Jan 2026 13:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981701#M6574</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2026-01-08T13:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981705#M6575</link>
      <description>&lt;P&gt;I believe what you are seeing is that parsing and compiling a SAS program requires memory.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Recall that a macro call is a PREPROCESSOR. It generates test, which are usually SAS statements. In the '%macro loop' example, the&amp;nbsp;macro generates a program that contains 300 MILLION statements. It doesn't matter what the statements are, what matters is that there are 300 million statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This huge program is then sent to PROC IML for parsing and execution. The parsing is performed in C. Parsing the program results in a (huge!) C structure that represents the program. That structure is then sent to the procedure for execution. If the amount of memory exceeds the MEMSIZE option in your SAS session, SAS will report an out-of-memory error, which is what is happening in your example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your example isn't limited to PROC IML. You can see the same behavior in the DATA step if you use macro to generate a program that contains hundreds of millions of lines. I ran the following macro code to generate huge programs in both the DATA step and PROC IML.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options fullstimer;
options nosource;

%macro IMLtest(numStmts);
%put Test IML: numStmts=%sysfunc(putn(&amp;amp;numStmts,comma9.));
proc iml;
a = 1;
%do i=1 %to &amp;amp;numStmts;
	b = a;
%end;
quit;
%mend;
%put ----- START IML TESTS -----;
%IMLtest(10000);
%IMLtest(100000);
%IMLtest(500000);
%IMLtest(1000000);

%macro DStest(numStmts);
%put Test DATA Step: numStmts=%sysfunc(putn(&amp;amp;numStmts,comma9.));
data _NULL_;
a = 1;
%do i=1 %to &amp;amp;numStmts;
	b = a;
%end;
run;
%mend;
%put ----- START DATA STEP TESTS -----;
%DStest(10000);
%DStest(100000);
%DStest(500000);
%DStest(1000000);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To make the programs comparable, I use 'a=1' in IML and in the DATA step. If 'a' is a vector in IML, then IML will use a little more memory, but it is really the length of the program (known at compile time) that is causing this issue, not the run-time memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On my PC version of SAS, the memory usage for each PROC is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data VizMemory;
length Proc $10;
input Proc numStmts Memory;
label numStmts="Number of Statements" Memory="Memory (k)";
format numStmts Memory comma10.;
datalines;
DATA_STEP 10000 3907
DATA_STEP 100000 37787
DATA_STEP 500000 180044
DATA_STEP 1000000 359641
IML 1000 254
IML 10000 1428
IML 100000 12698
IML 500000 62705
IML 1000000 125271
;

title "Memory Usage to Parse and Compile SAS Programs";
proc sgplot data=VizMemory;
  series x=numStmts y=Memory / group=Proc markers;
  xaxis grid;
  yaxis grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot4.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112553i0A8BB3DF755E3051/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot4.png" alt="SGPlot4.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The memory usage scales linearly with the number of SAS statements in the programs. The DATA step actually uses more memory than PROC IML to parse and execute a similar program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, in conclusion, you are seeing the result of generating a program that is hundreds of millions of lines long. Those text statements are parsed, which converts the text to a C structure, which requires considerable memory. (Think about a linked list that has 300 million items, and each item has information about the statement and the symbols.)&amp;nbsp; My advice is to use the loops and conditional logic in IML to write your program, rather than using the macro preprocessor to generate repeated statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 15:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981705#M6575</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2026-01-08T15:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981706#M6576</link>
      <description>&lt;P&gt;By using macro code to generate more STATEMENTS you are changing the size of the program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you instead generate the statements to a text file and ask PROC IML to %INCLUDE to&amp;nbsp; execute those 300 million statements?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 15:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981706#M6576</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-08T15:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981718#M6577</link>
      <description>&lt;P&gt;Many thanks for the detailed analysis! So basically are you saying that these lines of code&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%do i=1 %to 1000000;
	b = a;
%end;&lt;/LI-CODE&gt;
&lt;P&gt;are turned into 1000000 lines of text where each line is equal to "b = a;" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="simple-translate" class="simple-translate-system-theme"&gt;
&lt;DIV&gt;
&lt;DIV class="simple-translate-button isShow" style="background-image: url('chrome-extension://cllnohpbfenopiakdcjmjcbaeapmkcdl/icons/512.png'); height: 22px; width: 22px; top: 31px; left: 550px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="simple-translate-panel " style="width: 300px; height: 200px; top: 0px; left: 0px; font-size: 13px;"&gt;
&lt;DIV class="simple-translate-result-wrapper" style="overflow: hidden;"&gt;
&lt;DIV class="simple-translate-move" draggable="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="simple-translate-result-contents"&gt;
&lt;P class="simple-translate-result"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="simple-translate-candidate"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Jan 2026 16:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981718#M6577</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2026-01-08T16:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981719#M6578</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446135"&gt;@Rabelais&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Many thanks for the detailed analysis! So basically are you saying that these lines of code&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%do i=1 %to 1000000;
	b = a;
%end;&lt;/LI-CODE&gt;
&lt;P&gt;are turned into 1000000 lines of text where each line is equal to "b = a;" ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes.&amp;nbsp; That is how a macro PRE-processor works.&amp;nbsp; And SAS's macro is no different. It intercepts the program and sends the results on to SAS to actually execute.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 16:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981719#M6578</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-08T16:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981720#M6579</link>
      <description>&lt;P&gt;Of course. The SAS macro facility generates text, usually SAS statements.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 16:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981720#M6579</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2026-01-08T16:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting inside a macro loop leads to Out of memory for symbols ERROR</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981745#M6580</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446135"&gt;@Rabelais&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Many thanks for the detailed analysis! So basically are you saying that these lines of code&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%do i=1 %to 1000000;
	b = a;
%end;&lt;/LI-CODE&gt;
&lt;P&gt;are turned into 1000000 lines of text where each line is equal to "b = a;" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The SAS option MPRINT, assuming no syntax problems will show the generated code in the LOG.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;%macro loop;
%do i=1 %to 25;
   %put Loop is &amp;amp;i. ;
%end;
%mend;

options mprint;
%loop&lt;/PRE&gt;
&lt;P&gt;The log will show the result of each %put statement, only 25 in this case. I used that for an example to avoid the errors that would occur with assignments when no data step is present.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turn off the option with :&lt;/P&gt;
&lt;P&gt;options nomprint;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;after the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The options SYMBOLGEN will show the results of creating and combining macro variable values, MLOGIC will show the result of macro logic comparisons such as %if statements.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 06:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Overwriting-inside-a-macro-loop-leads-to-Out-of-memory-for/m-p/981745#M6580</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-01-09T06:02:27Z</dc:date>
    </item>
  </channel>
</rss>

