<?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: ABC of macro in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63356#M18010</link>
    <description>Hello Patrick,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the suggestion, I will run it as well. I prefer not to use macros as I am not very comfortable with it..  I hope this will work as well.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
hani</description>
    <pubDate>Sun, 08 May 2011 05:33:42 GMT</pubDate>
    <dc:creator>Hani</dc:creator>
    <dc:date>2011-05-08T05:33:42Z</dc:date>
    <item>
      <title>ABC of macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63352#M18006</link>
      <description>Hello all,&lt;BR /&gt;
&lt;BR /&gt;
I would like to run the following two programs with a macro.  Can somebody help me.&lt;BR /&gt;
&lt;BR /&gt;
I need to run it for different cases (from 1 to 10), and what I need to vary from 1 to 10 are specified below.&lt;BR /&gt;
&lt;BR /&gt;
I have basic knowledge in macros, and I appreciate your help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data sample1;   /*sample1  to sample10*/&lt;BR /&gt;
  set sample;   &lt;BR /&gt;
    if id_case=1;    /*case1  to case10*/&lt;BR /&gt;
  run;&lt;BR /&gt;
&lt;BR /&gt;
data Control;           &lt;BR /&gt;
  merge Control1       /*control1  to control10*/&lt;BR /&gt;
           Sample1 ;    /*sample1  to sample10*/&lt;BR /&gt;
  by ID_case;&lt;BR /&gt;
 run;</description>
      <pubDate>Sat, 07 May 2011 09:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63352#M18006</guid>
      <dc:creator>Hani</dc:creator>
      <dc:date>2011-05-07T09:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: ABC of macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63353#M18007</link>
      <description>Not tested:&lt;BR /&gt;
&lt;BR /&gt;
%macro MergeCtrlSmpl;&lt;BR /&gt;
  %do case=1 %to 10;&lt;BR /&gt;
    data CTRL_&amp;amp;case; &lt;BR /&gt;
      merge Control&amp;amp;case &lt;BR /&gt;
      Sample&amp;amp;case (where=(id_case=&amp;amp;case)) ; &lt;BR /&gt;
      by ID_case;&lt;BR /&gt;
    run; &lt;BR /&gt;
&lt;BR /&gt;
    proc append base=control data=CTRL_&amp;amp;case force;&lt;BR /&gt;
    run;	&lt;BR /&gt;
  %end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
%MergeCtrlSmpl;</description>
      <pubDate>Sat, 07 May 2011 14:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63353#M18007</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-05-07T14:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: ABC of macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63354#M18008</link>
      <description>Perfect, thank you very much.&lt;BR /&gt;
It works fine.&lt;BR /&gt;
Take care</description>
      <pubDate>Sat, 07 May 2011 18:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63354#M18008</guid>
      <dc:creator>Hani</dc:creator>
      <dc:date>2011-05-07T18:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABC of macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63355#M18009</link>
      <description>Hi Hani&lt;BR /&gt;
&lt;BR /&gt;
Below code for SAS9.2 would allow you to get your desired result without the use of macro code at all (which I believe is always preferable):&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data control;&lt;BR /&gt;
merge sample(where=(id_case GE 1 and id_case LE 10))&lt;BR /&gt;
control1 - control10;&lt;BR /&gt;
by id_case;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick

Message was edited by: Patrick</description>
      <pubDate>Sun, 08 May 2011 02:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63355#M18009</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-05-08T02:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: ABC of macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63356#M18010</link>
      <description>Hello Patrick,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the suggestion, I will run it as well. I prefer not to use macros as I am not very comfortable with it..  I hope this will work as well.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
hani</description>
      <pubDate>Sun, 08 May 2011 05:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ABC-of-macro/m-p/63356#M18010</guid>
      <dc:creator>Hani</dc:creator>
      <dc:date>2011-05-08T05:33:42Z</dc:date>
    </item>
  </channel>
</rss>

