<?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 Combining data set into a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259123#M269007</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to reuse the text from a macro to combine some data set using the SET statement but the name of the datasets I want to combine are macro variables (see the example below), therefore the only result in the data set "Lis_prob_&amp;amp;variable" is the information of the last data set "prob_mar130". Any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO example (variable=);&lt;/P&gt;&lt;P&gt;SAS statements&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;ODS OUTPUT ModelANOVA = prob_&amp;amp;variable;&lt;BR /&gt;DATA List_prob_&amp;amp;variable;&lt;BR /&gt;SET prob_&amp;amp;marker; IF effect = "&amp;amp;variable";&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;%MEND example;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%example (variable = mar1);&lt;BR /&gt;%example (variable = mar2);&lt;BR /&gt;;&lt;BR /&gt;%example (variable = mar130);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
    <pubDate>Fri, 25 Mar 2016 19:11:45 GMT</pubDate>
    <dc:creator>Fersal</dc:creator>
    <dc:date>2016-03-25T19:11:45Z</dc:date>
    <item>
      <title>Combining data set into a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259123#M269007</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to reuse the text from a macro to combine some data set using the SET statement but the name of the datasets I want to combine are macro variables (see the example below), therefore the only result in the data set "Lis_prob_&amp;amp;variable" is the information of the last data set "prob_mar130". Any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO example (variable=);&lt;/P&gt;&lt;P&gt;SAS statements&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;ODS OUTPUT ModelANOVA = prob_&amp;amp;variable;&lt;BR /&gt;DATA List_prob_&amp;amp;variable;&lt;BR /&gt;SET prob_&amp;amp;marker; IF effect = "&amp;amp;variable";&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;%MEND example;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%example (variable = mar1);&lt;BR /&gt;%example (variable = mar2);&lt;BR /&gt;;&lt;BR /&gt;%example (variable = mar130);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2016 19:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259123#M269007</guid>
      <dc:creator>Fersal</dc:creator>
      <dc:date>2016-03-25T19:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data set into a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259126#M269008</link>
      <description>&lt;P&gt;Given your example it doesn't make a heck of a lot of sense to use a macro in the first place. Can you expand your problem description?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That at being said, you can add an append at the end of your macro to append the results to a master table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the : to specify all datasets starting with a specific prefix. If you use the same prefix for other tables this will not work. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data want;
Set list_prob_: indsname =source;
Dataset_source=source;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Mar 2016 19:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259126#M269008</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-25T19:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data set into a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259147#M269009</link>
      <description>&lt;P&gt;I'm not certain of the structure of the ODS output data sets here ... if they always use the same structure you could modify the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO example (variable=);&lt;/P&gt;
&lt;P&gt;SAS statements&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;ODS OUTPUT ModelANOVA = prob_&amp;amp;variable;&lt;BR /&gt;DATA List_prob_&amp;amp;variable;&lt;BR /&gt;SET prob_&amp;amp;marker; IF effect = "&amp;amp;variable";&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;proc append data=prob_&amp;amp;variable base=all_anova_results;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%MEND example;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be aware that this will always add to existing results (assuming it works) and never replace what was there before.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2016 20:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259147#M269009</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-25T20:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data set into a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259317#M269010</link>
      <description>&lt;P&gt;Thanks, even with my bad explanation of the issue, you were able to understand the essence what I wanted to do, finally I got to combine the datasets using ":" and using some conditional statements, I tried with the append procedure but it doesn't work since the structure of some datasets were not exactly the same (eg. length of some variables).&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 09:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set-into-a-macro/m-p/259317#M269010</guid>
      <dc:creator>Fersal</dc:creator>
      <dc:date>2016-03-28T09:25:42Z</dc:date>
    </item>
  </channel>
</rss>

