<?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: How to use conditional statements with a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70624#M15279</link>
    <description>It appears you are attempting to use the ampersand character as an operator "AND" condition.  Separate the "&amp;amp;" from the SAS variable "Resid" so that SAS does not interpret the string as a macro variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Wed, 08 Sep 2010 03:01:14 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-09-08T03:01:14Z</dc:date>
    <item>
      <title>How to use conditional statements with a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70623#M15278</link>
      <description>Hello all,&lt;BR /&gt;
&lt;BR /&gt;
so I am working on this program:&lt;BR /&gt;
&lt;BR /&gt;
%macro sc(i,resdata);&lt;BR /&gt;
proc iml;&lt;BR /&gt;
	start delcol(x,i);&lt;BR /&gt;
		return(x[,setdif(1:ncol(x),i)]);&lt;BR /&gt;
	finish;	&lt;BR /&gt;
&lt;BR /&gt;
	use test&amp;amp;i;&lt;BR /&gt;
	read all into x;&lt;BR /&gt;
	x=delcol(x,{1,2}); print x;&lt;BR /&gt;
&lt;BR /&gt;
	use &amp;amp;resdata;&lt;BR /&gt;
	read all var {Resid} into y where(id=(&amp;amp;i+1)&lt;B&gt;&amp;amp;Resid^=.&lt;/B&gt;); print y;&lt;BR /&gt;
&lt;BR /&gt;
	sc=x*y; print sc;&lt;BR /&gt;
quit;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
I am getting this error: WARNING: Apparent symbolic reference RESID not resolved.&lt;BR /&gt;
&lt;BR /&gt;
I believe its from the part in the code I bolded. I think the macro thinks that resid is an input variable (like i and resdata) but it is really part of the where condition. Is there anyway I can tell the macro that &amp;amp;Resid is not part of the inputs?</description>
      <pubDate>Wed, 08 Sep 2010 02:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70623#M15278</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-08T02:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use conditional statements with a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70624#M15279</link>
      <description>It appears you are attempting to use the ampersand character as an operator "AND" condition.  Separate the "&amp;amp;" from the SAS variable "Resid" so that SAS does not interpret the string as a macro variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 08 Sep 2010 03:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70624#M15279</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-09-08T03:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use conditional statements with a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70625#M15280</link>
      <description>Or try quoting the &amp;amp;...&lt;BR /&gt;
&lt;BR /&gt;
where(id=(&amp;amp;i+1)%nrquote(&amp;amp;)Resid^=.); print y;  sc=x*y; print sc; quit;</description>
      <pubDate>Mon, 13 Dec 2010 15:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-conditional-statements-with-a-macro/m-p/70625#M15280</guid>
      <dc:creator>PatrickG</dc:creator>
      <dc:date>2010-12-13T15:51:30Z</dc:date>
    </item>
  </channel>
</rss>

