<?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: problem with macro! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-with-macro/m-p/47104#M9730</link>
    <description>put your comments in /*  ... */ format.  Statement form comments can't be used in the middle of an IF-THEN-ELSE construct.</description>
    <pubDate>Wed, 17 Sep 2008 17:50:20 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2008-09-17T17:50:20Z</dc:date>
    <item>
      <title>problem with macro!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-macro/m-p/47103#M9729</link>
      <description>Problem with macro,&lt;BR /&gt;
I am tyring to run this macro, but am a little confused. &lt;BR /&gt;
&lt;BR /&gt;
%macro AgeSplit(varname=);&lt;BR /&gt;
if      (agegrup=1 and a&amp;amp;varname ge 1) then &amp;amp;varname.y=1;&lt;BR /&gt;
else if (agegrup=1 and b&amp;amp;varname ge 1) then &amp;amp;varname.y=1;&lt;BR /&gt;
&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
%AgeSplit(varname=mim);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
When I try to run this I get log error stating this:&lt;BR /&gt;
NOTE: Line generated by the invoked macro "AGESPLIT".&lt;BR /&gt;
1      *** Youngest cohort ***; if      (aagegrup=1 and a&amp;amp;varname ge 1) then &amp;amp;varname.y=1;&lt;BR /&gt;
                                --&lt;BR /&gt;
                                180&lt;BR /&gt;
&lt;BR /&gt;
ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Line generated by the invoked macro "AGESPLIT".&lt;BR /&gt;
1                                                                                          else&lt;BR /&gt;
                                                                                           ----&lt;BR /&gt;
                                                                                           180&lt;BR /&gt;
1   ! if (bagegrup=1 and b&amp;amp;varname ge 1) then &amp;amp;varname.y=1; *** Middle cohort ***; else if&lt;BR /&gt;
&lt;BR /&gt;
ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;
&lt;BR /&gt;
My set of variables of interst are mim from my data set. I have more then one but put one here for simplicity. But I am not inserting it correctly into this macro. ‘varname’ is a place holder, but I am not sure where I should replace ‘varname’ with my variable of interest.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone help?</description>
      <pubDate>Wed, 17 Sep 2008 17:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-macro/m-p/47103#M9729</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-09-17T17:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: problem with macro!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-macro/m-p/47104#M9730</link>
      <description>put your comments in /*  ... */ format.  Statement form comments can't be used in the middle of an IF-THEN-ELSE construct.</description>
      <pubDate>Wed, 17 Sep 2008 17:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-macro/m-p/47104#M9730</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2008-09-17T17:50:20Z</dc:date>
    </item>
  </channel>
</rss>

