<?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: Plots loop in macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123877#M259978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Richard in Oz,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I corrected my code with your remarks. The log is just the code lines of my macro. There is no error/warning...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arnaud&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2012 10:07:46 GMT</pubDate>
    <dc:creator>arnaudd</dc:creator>
    <dc:date>2012-11-12T10:07:46Z</dc:date>
    <item>
      <title>Plots loop in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123875#M259976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to build a macro who plots several fits depending on the degree of freedom in a proc gam. Here are my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET df_ind = 4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO PlotFit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do &amp;amp;df_ind=4 %to 15;&lt;/P&gt;&lt;P&gt;PROC GAM data= C.one;&lt;/P&gt;&lt;P&gt;model cost=spline(age,df=&amp;amp;df_ind)/DIST=GAMMA;&lt;/P&gt;&lt;P&gt;output out=C.Fit&amp;amp;df_ind_M p;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;title "Fit with df=&amp;amp;df_ind";&lt;/P&gt;&lt;P&gt;proc gplot C.Fit&amp;amp;df_ind_M;&lt;/P&gt;&lt;P&gt;plot P_cost*age cost*age/overlay;&lt;/P&gt;&lt;P&gt;symbol interpol=join l=1 w=2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MEND PlotFit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%PlotFit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is: there's just one fit in my output (corresponding to df_in=4). I don't understand why I haven't a fit for each value of df_ind from 4 to 15. I'm quite new with SAS macro so excuse my lack of knowledge!Loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arnaud&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 09:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123875#M259976</guid>
      <dc:creator>arnaudd</dc:creator>
      <dc:date>2012-11-12T09:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Plots loop in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123876#M259977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Couple of things to note just looking at your code&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The statement %LET df_ind = 4; achieves nothing.&amp;nbsp; But I doubt it has any impact on the result.&lt;/LI&gt;&lt;LI&gt;It looks like you are trying to create individual datasets for each value of df_in.&amp;nbsp; But the dataset name has to be C.Fit&amp;amp;df_ind._M with a period (dot) after df_ind.&amp;nbsp; Other wise SAS will look for a macro variable &amp;amp;df_ind_M which is undefined.&amp;nbsp; &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Can you show us the log? At least the part which reports any errors or warnings, and the note(s) relating to any output tables that are created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard in Oz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 09:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123876#M259977</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-11-12T09:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Plots loop in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123877#M259978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Richard in Oz,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I corrected my code with your remarks. The log is just the code lines of my macro. There is no error/warning...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arnaud&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 10:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123877#M259978</guid>
      <dc:creator>arnaudd</dc:creator>
      <dc:date>2012-11-12T10:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Plots loop in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123878#M259979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There were a couple of errors in your code.&lt;/P&gt;&lt;P&gt;As said before the&lt;/P&gt;&lt;P&gt;%let df_ind = 4 confuses SAS, because in your macro you start with a DO-LOOP that resolves to;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;do 4 = 4 to 15;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Nonsense.&lt;/P&gt;&lt;P&gt;So I modified your code (I used sashelp.class as data set since I didn't have your data)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;First, in the DO-LOOP your&lt;STRONG&gt; df_ind is not a macro variable&lt;/STRONG&gt; for the macro PlotFit.&lt;/P&gt;&lt;P&gt;I added a &lt;STRONG&gt;PROC SORT&lt;/STRONG&gt; so I can make some meaning in what I am plotting;&lt;/P&gt;&lt;P&gt;I added a&lt;STRONG&gt; "data ="&lt;/STRONG&gt; in your PROC GPLOT;&lt;/P&gt;&lt;P&gt;(Please note that you need to change the &lt;STRONG&gt;bolded&lt;/STRONG&gt; text in the code below)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;%MACRO PlotFit;&lt;/P&gt;&lt;P&gt;%do df_ind=&lt;STRONG&gt;2 %to 3&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC GAM data= &lt;STRONG&gt;sashelp.class;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;model &lt;STRONG&gt;weight&lt;/STRONG&gt;=spline(age,df=&lt;STRONG&gt;&amp;amp;df_ind.&lt;/STRONG&gt;)/DIST=GAMMA;&lt;/P&gt;&lt;P&gt;output out=Fit&amp;amp;df_ind._M p;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sort data = Fit&amp;amp;df_ind._M;by p_weight;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;title "Fit with df=&amp;amp;df_ind.";&lt;/P&gt;&lt;P&gt;proc gplot data =&amp;nbsp; Fit&amp;amp;df_ind._m;&lt;/P&gt;&lt;P&gt;plot &lt;STRONG&gt;P_weight&lt;/STRONG&gt;*age &lt;STRONG&gt;weight&lt;/STRONG&gt;*age/overlay;&lt;/P&gt;&lt;P&gt;symbol interpol=join l=1 w=2;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%MEND PlotFit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%PlotFit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck!&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 14:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123878#M259979</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2012-11-12T14:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Plots loop in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123879#M259980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since the last line is a call to the macro then you should see notes and messages as it tries to run it.&amp;nbsp; If you are not then you probably have unbalanced quotes, parenthesis or other things that is causing to not see the macro call.&amp;nbsp; Sometimes it is easiest to just save your program, close SAS and start over to clear up that type of issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 15:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plots-loop-in-macro/m-p/123879#M259980</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-11-12T15:18:09Z</dc:date>
    </item>
  </channel>
</rss>

