<?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: Sas macro, Results from multiple runs of macro should append in one dataset , but its not, why?? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274849#M54904</link>
    <description>&lt;P&gt;Please post a description of the solution or error so others may benefit from your experience.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2016 05:14:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-06-03T05:14:09Z</dc:date>
    <item>
      <title>Sas macro, Results from multiple runs of macro should append in one dataset , but its not, why??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274807#M54889</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have recently started using macro is sas and I am stuck at this issue. Please help!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the covaraince estimates from proc mixed in sas for around 45 varaibles in my data set. I want to append the results in a final data set and I also want that the final dataset should tell me which varaince components belong to which varaible. So&amp;nbsp; after proc mixed , I am creating a dataset&amp;nbsp; named new to add those varaible name from the macro statement in the data.(VARNAME,and CAT). But actually when I run this macro and print the final results I should have three variance components from each iteration of macro, but actually it has way more than that. I don't understand what I am doing wrong. Please suggest some way out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;%MACRO var(DATA, VARNAME,cat);
ods select none;
ods output covparms=Cov_Estimates;
proc mixed data=prep method=type1 cl;
class pt image scanwithinday ;
model &amp;amp;varname=;
random pt scanwithinday(pt);
run;

data new;
set new Cov_Estimates;
retain Vname Category;
call symput ('Vname','&amp;amp;varname' );
call symput ('Category','&amp;amp;cat');
run;
data final;
set final new ;run;
%mend;
data final;stop;
%var(data, varname=vp_dl,cat=Localisation and Distance);
%var(data,varname=vp_dr,cat=Localisation and Distance);
%var(data,varname=dl_dr,cat=Localisation and Distance);&lt;BR /&gt;&lt;BR /&gt;ods select all;&lt;BR /&gt;proc print data=final;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 20:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274807#M54889</guid>
      <dc:creator>Ruhi</dc:creator>
      <dc:date>2016-06-02T20:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sas macro, Results from multiple runs of macro should append in one dataset , but its not, why??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274812#M54890</link>
      <description>&lt;P&gt;Did a dataset NEW or FINAL exist before running the code? Possibly left over from testing/development? If you didn't delete the sets then the previous data was still around and you added to it. That would be my guess for most likely cause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what these lines are intended to accomplish:&lt;/P&gt;
&lt;P&gt;call &lt;SPAN class="token function"&gt;symput&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Vname'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'&amp;amp;varname'&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;call &lt;SPAN class="token function"&gt;symput&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Category'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'&amp;amp;cat'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;But they will not result in what you likely intended as macro variables should be between double quotes to resolve to the assigned value:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;call &lt;SPAN class="token function"&gt;symput&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Vname'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,"&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;&amp;amp;varname"&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;call &lt;SPAN class="token function"&gt;symput&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Category'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,"&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;&amp;amp;cat"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 21:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274812#M54890</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-02T21:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sas macro, Results from multiple runs of macro should append in one dataset , but its not, why??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274823#M54894</link>
      <description>&lt;P&gt;I figured out my mistake. Thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 21:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274823#M54894</guid>
      <dc:creator>Ruhi</dc:creator>
      <dc:date>2016-06-02T21:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sas macro, Results from multiple runs of macro should append in one dataset , but its not, why??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274849#M54904</link>
      <description>&lt;P&gt;Please post a description of the solution or error so others may benefit from your experience.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 05:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274849#M54904</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-03T05:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas macro, Results from multiple runs of macro should append in one dataset , but its not, why??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274881#M54912</link>
      <description>&lt;P&gt;Why do you need a macro for that? &amp;nbsp;You will be aware of by group processing, set your data up correctly and you could simply by group the whole dataset:&lt;/P&gt;
&lt;PRE&gt;proc mixed data=prep method=type1 cl;
  by &amp;lt;group variables&amp;gt;;
  class pt image scanwithinday ;
  model &amp;lt;variable&amp;gt;=;
  random pt scanwithinday(pt);
run;&lt;/PRE&gt;
&lt;P&gt;Far simpler and more efficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 08:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-macro-Results-from-multiple-runs-of-macro-should-append-in/m-p/274881#M54912</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-03T08:31:56Z</dc:date>
    </item>
  </channel>
</rss>

