<?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: macro do problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177822#M34013</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your proc reg isn't valid SAS code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get a working version of your proc reg and then embed it in a loop. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 11 Jan 2015 18:57:54 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-01-11T18:57:54Z</dc:date>
    <item>
      <title>macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177821#M34012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is wrong with my macro? Can't seem to run it, only get black text in the editor screen.&lt;/P&gt;&lt;P&gt;I have a dataset with one variable diff, and i wan't to find the constant growth for a subseries of windows of 8 observations. &lt;/P&gt;&lt;P&gt;For each regression i want to save the output residuals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%macro lol; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%do i=1 %to 36; &lt;/P&gt;&lt;P&gt;proc reg data = data.test (firstobs = &amp;amp;i obs = &amp;amp;i + 7);&lt;/P&gt;&lt;P&gt;model dif = ; &lt;/P&gt;&lt;P&gt;output out = data.lol&amp;amp;i;&lt;/P&gt;&lt;P&gt;r = 1975 + &amp;amp;i &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend lol;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2015 18:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177821#M34012</guid>
      <dc:creator>hamudi</dc:creator>
      <dc:date>2015-01-11T18:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177822#M34013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your proc reg isn't valid SAS code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get a working version of your proc reg and then embed it in a loop. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2015 18:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177822#M34013</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-11T18:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177823#M34014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you elaborate? &lt;/P&gt;&lt;P&gt;the proc reg works without the macro and do loop. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2015 19:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177823#M34014</guid>
      <dc:creator>hamudi</dc:creator>
      <dc:date>2015-01-11T19:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177824#M34015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a log of your reg code working? There is no R statement as far as I'm aware.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2015 19:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177824#M34015</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-11T19:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177825#M34016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use OBS=1+7 in a dataset option.&amp;nbsp; You could use %EVAL() to have the macro processor convert that to 8 instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the R= statement in your PROC REG code? Are you trying to calculate a new variable?&amp;nbsp; Even if PROC REG allowed that it would be a constant for each regression and so not add anything to the regression model.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2015 19:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177825#M34016</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-01-11T19:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177826#M34017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;3 main errors in your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &amp;amp;i+7 needs the %eval function to resolve&lt;/P&gt;&lt;P&gt;2. Proc Reg has no R= statement&lt;/P&gt;&lt;P&gt;3. Model Dep= results in an intercept only model, I think that would be the difference from the mean of the results.&amp;nbsp; Not sure what the need would be for that, but if its what your looking for I guess that's fine. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2015 20:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177826#M34017</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-11T20:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177827#M34018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Reeza, appreciate the answers.&lt;/P&gt;&lt;P&gt;1) I will try and do that&lt;/P&gt;&lt;P&gt;2) It should give me the residuals -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RESIDUAL | R=&lt;EM&gt;names&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; residuals, calculated as ACTUAL minus PREDICTED&lt;/P&gt;&lt;P&gt;3) Yeah, i know, i actuallly only need the residuals from the regression, for further calculations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 10:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177827#M34018</guid>
      <dc:creator>hamudi</dc:creator>
      <dc:date>2015-01-13T10:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177828#M34019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are right, i will try with the %eval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The R = should give me a new variable for the residuals. It works when performing a single regression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESIDUAL | R=&lt;EM&gt;names&lt;/EM&gt; &lt;/P&gt;&lt;P&gt; residuals, calculated as ACTUAL minus PREDICTED &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 10:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177828#M34019</guid>
      <dc:creator>hamudi</dc:creator>
      <dc:date>2015-01-13T10:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177829#M34020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So RESIDUALS is key word on the OUTPUT statement, not a separate statement.&lt;/P&gt;&lt;P&gt;It tells the proc what variable name to use for to store the residual value.&amp;nbsp; So again you cannot have a variable name that starts with a number or has a plus sign embedded in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc reg data = data.test (firstobs = &amp;amp;i obs = %eval(&amp;amp;i + 7) );&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;model dif = ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;output out = data.lol&amp;amp;i&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; r = res_%eval(1975 + &amp;amp;i)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 12:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177829#M34020</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-01-13T12:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: macro do problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177830#M34021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Tom. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 12:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-do-problem/m-p/177830#M34021</guid>
      <dc:creator>hamudi</dc:creator>
      <dc:date>2015-01-13T12:07:55Z</dc:date>
    </item>
  </channel>
</rss>

