<?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: %If &amp;amp; then Error in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628967#M20700</link>
    <description>&lt;P&gt;Hallelujah! Thank you! It worked. I tried everything for hours, but that.&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2020 23:44:00 GMT</pubDate>
    <dc:creator>sas_noob420</dc:creator>
    <dc:date>2020-03-02T23:44:00Z</dc:date>
    <item>
      <title>%If &amp; then Error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628959#M20698</link>
      <description>&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am new to macros. I'm having trouble getting it to run properly. &amp;amp;q resolves into either a 0 or 1. Whenever is resolves to a one then d=1, I then want it to assign variable1 the variable Count_parameter so I can use it in the bottom macro. If &amp;amp;q resolves to 0 then I want there to be no variable name in the parameter so that it is missing. However whenever I run it regardless of the value of d the variable one is always missing and then the parameters are missing from the next macro. I know this is because of the way SAS compiles, but I don't know how to fix it. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Let C1=Count_Parameter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;d=&amp;amp;q;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;%IF d=1 %THEN %DO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;%let variable1=&amp;amp;C1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;%END;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;%Else %DO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;%let variable1= ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;%END;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;%macroexample(var=&lt;FONT&gt;variable1&lt;/FONT&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 23:21:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628959#M20698</guid>
      <dc:creator>sas_noob420</dc:creator>
      <dc:date>2020-03-02T23:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: %If &amp; then Error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628961#M20699</link>
      <description>&lt;P&gt;The expression&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %if d=1 %then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will NEVER be true.&amp;nbsp;&amp;nbsp; Macro thinks you are comparing a one-letter character string (d) to the single digit (1).&amp;nbsp; You have to tell macro that D is a macro variable, not a literal text.&amp;nbsp; That's what the leading ampersand is for&amp;nbsp;&amp;nbsp;&amp;nbsp;So, lesson 1 in macro coding, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %if &amp;amp;d=1 %then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But before you get there you also need to change&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; d=&amp;amp;q;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %let d=&amp;amp;q;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 23:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628961#M20699</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-03-02T23:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: %If &amp; then Error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628967#M20700</link>
      <description>&lt;P&gt;Hallelujah! Thank you! It worked. I tried everything for hours, but that.&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 23:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-amp-then-Error/m-p/628967#M20700</guid>
      <dc:creator>sas_noob420</dc:creator>
      <dc:date>2020-03-02T23:44:00Z</dc:date>
    </item>
  </channel>
</rss>

