<?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 is not resolving in autosys run but running fine in EG in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693345#M211380</link>
    <description>Thanks a lot Tom. That worked. Next time onwards will keep this in mind.</description>
    <pubDate>Wed, 21 Oct 2020 22:28:12 GMT</pubDate>
    <dc:creator>rajdeep</dc:creator>
    <dc:date>2020-10-21T22:28:12Z</dc:date>
    <item>
      <title>Macro is not resolving in autosys run but running fine in EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693323#M211366</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;I have 2 sas files &lt;STRONG&gt;Prog1.sas&lt;/STRONG&gt; &amp;amp;&amp;nbsp;&lt;STRONG&gt; prog2.sas&lt;/STRONG&gt; like below. while executing &lt;STRONG&gt;prog1.sas&lt;/STRONG&gt; in EG it's running fine, but in autosys it's throwing an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Prog1 code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options nosyntaxcheck validvarname=any;
%macro DEL_MASTER(NAME);
%if %sysfunc(exist(&amp;amp;name)) %then %do ;

proc datasets library=work memtype=data kill nolist;

quit ;
%end ;
%else;
%put "Data set &amp;amp;name. does not exist";
%mend ;

%DEL_MASTER(piv.*);
options symbolgen mlogic mprint;

%macro post_sql;

%let rundate=01JAN97;
data _null_;
call symputx('rdatem','"'!!put("&amp;amp;rundate."d,date7.)!!'"d');
call symputx('rdate3',"'"!!put("&amp;amp;rundate."d,date9.)!!"'d",'G');
call symputx('rdate',"'"!!put("&amp;amp;rundate."d,date7.)!!"'");
call symputx('date',intnx('day',input("&amp;amp;rundate",date7.),-0));
run;

%global Month_ind;

PROC SQL;
SELECT distinct state into:state_ind
FROM SASHELP.PRDSAL3 t1
WHERE t1.DATE = &amp;amp;rdate3 and state='California';
QUIT;

%include "I:\PIV\Prog2.sas";

%DEL_MASTER(piv.*);

%mend;
%post_sql;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Prog2.sas Code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Monthly_Scenario;
%if &amp;amp;state_ind=California %then %do;
%put success;
%end;
%mend;
%Monthly_Scenario;
%put &amp;amp;state_ind;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;But I am getting an error like below while running in batch mode from autosys.&lt;/P&gt;
&lt;P&gt;Error in Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: 
&amp;amp;state_ind=California
ERROR: The macro MONTHLY_SCENARIO will stop executing.
MLOGIC(MONTHLY_SCENARIO): Ending execution.
MPRINT(POST_SQL): ;
NOTE: The SAS System stopped processing this step because of errors.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Just wanted to understand what is the&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;reason behind it. I am using the nosyntaxcheck options as well.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Please help.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 21:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693323#M211366</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-10-21T21:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro is not resolving in autosys run but running fine in EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693327#M211368</link>
      <description>&lt;P&gt;To make sure that the macro processor does not try (depending on the contents of your macro variable) to use integer arithmetic, do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if "&amp;amp;state_ind"="California" %then %do;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 21:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693327#M211368</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-21T21:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro is not resolving in autosys run but running fine in EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693337#M211374</link>
      <description>&lt;P&gt;The first macro in the first program looks like gibberish.&amp;nbsp; But you seem to be asking about the second program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is an easy issue.&amp;nbsp; The state abbreviation OR for Oregon looks to the macro processor like the logical operator or.&amp;nbsp; You can test it easily.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %eval( OR=California );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To prevent the implied %EVAL() call in the %IF statement from treating your macro variable value as an operator you could use macro quoting.&amp;nbsp; But it is probably a lot easier to just add quotes around the values being compared.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if "&amp;amp;state_ind"="California" %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 22:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693337#M211374</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-21T22:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro is not resolving in autosys run but running fine in EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693345#M211380</link>
      <description>Thanks a lot Tom. That worked. Next time onwards will keep this in mind.</description>
      <pubDate>Wed, 21 Oct 2020 22:28:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-is-not-resolving-in-autosys-run-but-running-fine-in-EG/m-p/693345#M211380</guid>
      <dc:creator>rajdeep</dc:creator>
      <dc:date>2020-10-21T22:28:12Z</dc:date>
    </item>
  </channel>
</rss>

