<?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: Macro error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594768#M170963</link>
    <description>I think it is because how Python handles situation like:&lt;BR /&gt;&lt;BR /&gt;x = 1&lt;BR /&gt;y = x&lt;BR /&gt;&lt;BR /&gt;vs.&lt;BR /&gt;&lt;BR /&gt;x = 1&lt;BR /&gt;y = 1&lt;BR /&gt;&lt;BR /&gt;all the best&lt;BR /&gt;Bart</description>
    <pubDate>Tue, 08 Oct 2019 14:41:24 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2019-10-08T14:41:24Z</dc:date>
    <item>
      <title>Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594733#M170948</link>
      <description>&lt;P&gt;Am I doing something wrong here? How to get rid of the error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options MINOPERATOR;
%macro validation;
	%if %sysfunc(exist(IFPART.BALANCE_SEGMENT) %then;
		%do;
			%if ACCOUNT_PERIOD is . % then
				%do;
					data MVP3;
						ERR_MSG_TXT='ACCOUNT_PERIOD cannot be missing';
						FLT_Id=1;
						FLT_REC_ID=1;
                                                FLT_REC_TXT='faulty conctenated Business key values'
					run;
				%end;
			%else
				%do;
					data _null_;
						%put "ACCOUNT_PERIOD is not missing";
					run;
					%end;




%mend;

%validation;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;ERROR:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;30         		%do;
ERROR: Macro keyword DO appears as text.
ERROR: A dummy macro will be compiled.
31         			%if ACCOUNT_PERIOD  is . % then
ERROR: Macro keyword IF appears as text.
32         				%do;
33         					data MVP3;
34         						ERR_MSG_TXT='ACCOUNT_PERIOD cannot be missing';
35         						FLT_Id=1;
36         						FLT_REC_ID=1;
37                                 FLT_REC_TXT='faulty conctenated Business key values'
38         					run;
39         				%end;
ERROR: Macro keyword END appears as text.
40         			%else
ERROR: There is no matching %IF statement for the %ELSE.
41         				%do;
ERROR: Macro keyword DO appears as text.
42         					data _null_;
43         						%put "ACCOUNT_PERIOD is not missing";
ERROR: Macro keyword PUT appears as text.
44         					run;
45         					%end;
2                                                          
ERROR: Macro keyword END appears as text.
46         
47         %mend;
ERROR: Macro keyword MEND appears as text.
48         
49         %validation;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:11:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594733#M170948</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-08T13:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594736#M170950</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Am I doing something wrong here? How to get rid of the error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options MINOPERATOR;
%macro validation;
	%if %sysfunc(exist(IFPART.BALANCE_SEGMENT) %then;
		%do;
			&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are missing a parenthesis above. Also, there is no semi-colon after %THEN&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:16:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594736#M170950</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-08T13:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594742#M170953</link>
      <description>&lt;P&gt;There are a lot of problems with that code. The one that is causing the error messages is the missing closing right parentheses from the %SYSFUNC() macro function call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the real mistake is this %IF statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  %if ACCOUNT_PERIOD is . % then %do;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That can never be true since the two strings you are comparing are not the same. One is long and starts with a capital letter A and the other is just the single character period.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you somehow what to test the value of the ACCOUNT_PERIOD variable in the dataset?&lt;/P&gt;
&lt;P&gt;Or did you have some macro variable named ACCOUNT_PERIOD and you just forgot to prefix the name with &amp;amp; so you could reference the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly there is no need for the DATA and RUN statements in this block of code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  %else %do;
     data _null_;
      %put "ACCOUNT_PERIOD is not missing";
     run;
  %end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please explain what you are trying to do.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594742#M170953</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-08T13:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594745#M170955</link>
      <description>&lt;P&gt;After you fixed the issues mentioned by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;,&amp;nbsp;you will have to check the line&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrostatement"&gt;%if&lt;/SPAN&gt; ACCOUNT_PERIOD is &lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;%&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first problem is the blank between % and "then", the second problem is the expression ... you will have to read the documentation to get it working.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594745#M170955</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-10-08T13:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594748#M170956</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;After you fixed the issues mentioned by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;,&amp;nbsp;you will have to check the line&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrostatement"&gt;%if&lt;/SPAN&gt; ACCOUNT_PERIOD is &lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;%&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first problem is the blank between % and "then", the second problem is the expression ... you will have to read the documentation to get it working.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, there are many problems here, including referring to ACCOUNT_PERIOD which doesn't seem to be defined but appears to be a data step variable, and then mixing and matching data step and macro language improperly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we don't really know what the code is supposed to do, I Point out that it is possible (depending on what the code is supposed to do) that no macros are needed here, and no macro variables are needed here. Which would simplify everything greatly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594748#M170956</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-08T13:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594752#M170958</link>
      <description>&lt;P&gt;I also don't recall the "is" operator,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options MINOPERATOR;
%macro validation(x);
			%if (&amp;amp;x. is 1) %then
				%do;
					data test;			
					run;
				%end;
%mend;

%validation(1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;143  options MINOPERATOR;
144  %macro validation(x);
145        %if (&amp;amp;x. is 1) %then
146          %do;
147            data test;
148            run;
149          %end;
150  %mend;
151
152  %validation(1);
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: (&amp;amp;x. is 1)
ERROR: The macro VALIDATION will stop executing.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594752#M170958</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-10-08T13:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594767#M170962</link>
      <description>&lt;P&gt;Just started reading 'python for SAS users', looks like python has an is operator, separate from == operator.&amp;nbsp; Interesting...&amp;nbsp;&amp;nbsp;&lt;A href="https://www.geeksforgeeks.org/difference-operator-python/" target="_blank"&gt;https://www.geeksforgeeks.org/difference-operator-python/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 14:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594767#M170962</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2019-10-08T14:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594768#M170963</link>
      <description>I think it is because how Python handles situation like:&lt;BR /&gt;&lt;BR /&gt;x = 1&lt;BR /&gt;y = x&lt;BR /&gt;&lt;BR /&gt;vs.&lt;BR /&gt;&lt;BR /&gt;x = 1&lt;BR /&gt;y = 1&lt;BR /&gt;&lt;BR /&gt;all the best&lt;BR /&gt;Bart</description>
      <pubDate>Tue, 08 Oct 2019 14:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594768#M170963</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-10-08T14:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594779#M170966</link>
      <description>In the else part I'm trying a note in the SAS log&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Oct 2019 15:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594779#M170966</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-08T15:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594976#M171086</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;In the else part I'm trying a note in the SAS log&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't just state the very obvious.&lt;/P&gt;
&lt;P&gt;What is ACCOUNT_PERIOD, and where does it come from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 08:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/594976#M171086</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-09T08:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/649781#M194843</link>
      <description>&lt;P&gt;The is operator compares the identity of two objects while the == operator compares the values of two objects. There is a difference in meaning between equal and identical. And this difference is important when you want to understand how Python's is and == comparison operators behave. The == operator is used when the values of two operands are equal, then the condition becomes true. The &lt;A href="http://net-informations.com/python/iq/is.htm" target="_self"&gt;is operator&lt;/A&gt; evaluates to true if the variables on either side of the operator point to the same object and false otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 05:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error/m-p/649781#M194843</guid>
      <dc:creator>bennetcole</dc:creator>
      <dc:date>2020-05-22T05:19:21Z</dc:date>
    </item>
  </channel>
</rss>

