<?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: Is there a limit to the number of models PROC REG can handle at once? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565961#M27886</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222965"&gt;@mathmannix&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;It does, and for C(6,2) = 15 models, it takes about 27 minutes. Not great, but I haven't found a more efficient way to run it.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is the size (numbers of observations and variables) of your input dataset and what is the number of BY groups? This information would help us to judge whether 27 min is reasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On my computer the setting &lt;FONT face="courier new,courier"&gt;ods graphics on;&lt;/FONT&gt; has an enormous impact on the run times of procedures which (like PROC REG) produce ODS graphics by default. For example, the run time of a PROC REG step for a single model of the form y=x1 x2 with 6 BY groups on SASHELP.HEART (~5000 obs.) soars from 0.04 s to &amp;gt;10.0 s as soon as I switch ODS graphics on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in your example ("&lt;FONT face="courier new,courier"&gt;by year state&lt;/FONT&gt;") PROC REG would possibly (try to) create up to 33,540,000 (!) plots if you requested 8385 models for each of the 400 combinations of, say, 8 years and 50 states (10 plots per model).&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2019 18:27:32 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2019-06-13T18:27:32Z</dc:date>
    <item>
      <title>Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565841#M27881</link>
      <description>&lt;P&gt;I am trying to get this code to work:&lt;/P&gt;&lt;PRE&gt;PROC REG DATA=CITIES;
	ID CITY;
	BY YEAR STATE;
	%DO I=1 %TO 5;
		%DO J=(&amp;amp;I.+1) %TO 6;
			X&amp;amp;I._X&amp;amp;J.: MODEL YVAR = X&amp;amp;I. X&amp;amp;J.;
		%END;
	%END;

	ODS OUTPUT FitStatistics=OUTPUT_1;
RUN;&lt;/PRE&gt;&lt;P&gt;It does, and for C(6,2) = 15 models, it takes about 27 minutes. Not great, but I haven't found a more efficient way to run it.&lt;/P&gt;&lt;P&gt;Anyway, I tried it with a larger number of models yesterday so it would run overnight, with I from 1 to 25 and J from (I+1) to 26. That is, C(26,2) = 325 models. It apparently couldn't handle that many models; it crashed after 2+ hours with the error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR:  An exception has been encountered.
Please contact technical support and provide them with the following traceback information:

The SAS task name is [REG]
ERROR:  Write Access Violation REG
Exception occurred at (########)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I really need to run it up to C(130,2) = 8385 models, while I go on vacation next week. But it doesn't seem to be able to handle this. So what is the limit on number of models REG can handle? And are there any thoughts on a better way to do this? (Previously I had macro loops with data steps and a PROC REG for each iteration, and that worked, but it was much, much slower.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 13:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565841#M27881</guid>
      <dc:creator>mathmannix</dc:creator>
      <dc:date>2019-06-13T13:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565846#M27882</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222965"&gt;@mathmannix&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR:  An exception has been encountered.
Please contact technical support and provide them with the following traceback information:

The SAS task name is [REG]
ERROR:  Write Access Violation REG
Exception occurred at (########)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Whether there is a limit (which I doubt), or some other problem, is something I don't know. However, the error message is very clear, you need to contact technical support.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;As far as the idea of running 8385 regression models each with two predictor variables, I'm sure there must be a better way, but then we don't really know what the project is or what your goals are. There are pre-programmed methods in SAS that run all possible combinations of models, or a subset thereof, so I would see if those would work for you, &lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_reg_details08.htm&amp;amp;locale=en" target="_self"&gt;specifically PROC REG with the option SELECTION=RSQUARE or SELECTION=CP&lt;/A&gt;. Also, I note that I do not recommend these methods in general, for statistical reasons that I won't get into here, but if you have a lot of variables and want to fit a model, I do recommend Partial Least Squares (PROC PLS) and put all your potential variables into the model and let PLS figure out which are the important ones.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 14:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565846#M27882</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-13T14:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565847#M27883</link>
      <description>&lt;P&gt;Submit this to SAS technical support, as this is not the way SAS should react in case it runs out of resources (its should throw the usual ERROR message with a code and a short description).&lt;/P&gt;
&lt;P&gt;But I think you will run out of resources if you try to run that many models in one procedure call.&lt;/P&gt;
&lt;P&gt;Have you considered wrapping the outer macro loop around the procedure call itself?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 13:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565847#M27883</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-13T13:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565857#M27884</link>
      <description>&lt;P&gt;You should show the code with two hard-coded cases that worked as intended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And your BY statement may not work as intended with multiple model statements:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;When a BY statement is used with PROC REG, interactive processing is not possible; that is, once the first RUN statement is encountered, processing proceeds for each BY group in the data set, and no further statements are accepted by the procedure.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 14:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565857#M27884</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-13T14:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565884#M27885</link>
      <description>There's tons of ways to make this work but you haven't provided enough information. I've run tens of thousands of linear regressions - usually considered bad practice today - without many issues and you can also turn it into a macro to run individually than a single pass if needed. I would also ensure to turn off any extra output and only capture what you need - HTML or Listing output can sometimes cause the memory issues because the files get too big.</description>
      <pubDate>Thu, 13 Jun 2019 15:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565884#M27885</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T15:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565961#M27886</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222965"&gt;@mathmannix&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;It does, and for C(6,2) = 15 models, it takes about 27 minutes. Not great, but I haven't found a more efficient way to run it.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is the size (numbers of observations and variables) of your input dataset and what is the number of BY groups? This information would help us to judge whether 27 min is reasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On my computer the setting &lt;FONT face="courier new,courier"&gt;ods graphics on;&lt;/FONT&gt; has an enormous impact on the run times of procedures which (like PROC REG) produce ODS graphics by default. For example, the run time of a PROC REG step for a single model of the form y=x1 x2 with 6 BY groups on SASHELP.HEART (~5000 obs.) soars from 0.04 s to &amp;gt;10.0 s as soon as I switch ODS graphics on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in your example ("&lt;FONT face="courier new,courier"&gt;by year state&lt;/FONT&gt;") PROC REG would possibly (try to) create up to 33,540,000 (!) plots if you requested 8385 models for each of the 400 combinations of, say, 8 years and 50 states (10 plots per model).&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 18:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/565961#M27886</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-06-13T18:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/566141#M27889</link>
      <description>&lt;P&gt;Wow, just wow. I did not know ODS Graphics was on by default. This makes PROC REG so much faster, thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 11:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/566141#M27889</guid>
      <dc:creator>mathmannix</dc:creator>
      <dc:date>2019-06-14T11:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a limit to the number of models PROC REG can handle at once?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/566167#M27890</link>
      <description>&lt;P&gt;You say you are running 15 or 325 models, but actually you are running that many times the number of joint levels in the YEAR and STATE variables. If you have 10 years and 50 states, that is 500*15 and 500*325 models.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is possible that your problem is caused because PROC REG automatically produces ODS graphics for each model.&lt;/P&gt;
&lt;P&gt;Prior to your PROC REG step, use&lt;/P&gt;
&lt;P&gt;ODS GRAPHICS OFF;&lt;/P&gt;
&lt;P&gt;to make sure the procedure does not create any graphs. You probably also want to suppress the thousands of other tables that are automatically created by using&lt;/P&gt;
&lt;P&gt;ODS exclude all;&lt;/P&gt;
&lt;P&gt;before the call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also think you need to use a VAR statement so that PROC REG will create and reuse a single X`X matrix that includes all the variables in the multiple models. For example,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR X: YVAR;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 13:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Is-there-a-limit-to-the-number-of-models-PROC-REG-can-handle-at/m-p/566167#M27890</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-06-14T13:54:02Z</dc:date>
    </item>
  </channel>
</rss>

