<?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 if then macro in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83041#M23812</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi here is my code snippet not sure why its bugging out. Seems not to like the in command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro mylist(dataset,code);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data &amp;amp;dataset;&lt;BR /&gt;set &amp;amp;dataset;&lt;/P&gt;&lt;P&gt;%if &amp;amp;code= "ted" and date&amp;gt;="03May1993"d %then D=1;&lt;BR /&gt;%if &amp;amp;code in ("ann", "joe", "fred") and date&amp;gt;="01Jan1988"d %then D=1;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Apr 2012 14:43:31 GMT</pubDate>
    <dc:creator>hdg</dc:creator>
    <dc:date>2012-04-13T14:43:31Z</dc:date>
    <item>
      <title>if then macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83041#M23812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi here is my code snippet not sure why its bugging out. Seems not to like the in command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro mylist(dataset,code);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data &amp;amp;dataset;&lt;BR /&gt;set &amp;amp;dataset;&lt;/P&gt;&lt;P&gt;%if &amp;amp;code= "ted" and date&amp;gt;="03May1993"d %then D=1;&lt;BR /&gt;%if &amp;amp;code in ("ann", "joe", "fred") and date&amp;gt;="01Jan1988"d %then D=1;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2012 14:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83041#M23812</guid>
      <dc:creator>hdg</dc:creator>
      <dc:date>2012-04-13T14:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: if then macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83042#M23813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS Version? Current MINOPERATOR value?&lt;/P&gt;&lt;P&gt;You probably don't actually want a macro IF from context. It appears that your date variable is from &amp;amp;dataset which means the MACRO IF doesn't know where to get values of date and is going to be treating it as text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try: if&amp;nbsp; "&amp;amp;code" in ... then D=1;&amp;nbsp; This assumes that code will have a value of ann or joe or similar when you call the macro.&lt;/P&gt;&lt;P&gt;Similarly you probably want: if "&amp;amp;code" = "ted" and ... then D=1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2012 14:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83042#M23813</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-04-13T14:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: if then macro</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83043#M23814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your macro %If , should be a data step IF...so then your &amp;amp;code macro var needs to be wrapped in quotes....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2012 14:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/if-then-macro/m-p/83043#M23814</guid>
      <dc:creator>Jay_TxOAG</dc:creator>
      <dc:date>2012-04-13T14:53:23Z</dc:date>
    </item>
  </channel>
</rss>

