<?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 executio: ERROR 180-322: Statement is not valid or it is used out of proper order. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199259#M49800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are confusing data step processing with macro processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro id_relevant(tab= ,id= );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %local result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put "&amp;amp;&amp;amp;&amp;amp;id._RELEVANT."; &lt;SPAN style="color: #ff0000;"&gt;This %put is executed by the macro processor BEFORE the data step is compiled!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp=find("&amp;amp;&amp;amp;&amp;amp;id._RELEVANT.",cat("&amp;amp;tab.",',')); &lt;SPAN style="color: #ff0000;"&gt;The find function returns a number! This statement is executed during data step processing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put tmp; &lt;SPAN style="color: #ff0000;"&gt;This %put is also executed by the macro processor BEFORE the data step is compiled!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput("result",tmp); &lt;SPAN style="color: #ff0000;"&gt;This is executed DURING data step processing, placing a number in the macro variable result&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;result &lt;SPAN style="color: #ff0000;"&gt;Here the macro processor replaces &amp;amp;result with the contents of the macro variable result, which happens to be a number; a single number is NOT valid SAS code, causing the error message!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Mar 2015 15:27:09 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-03-11T15:27:09Z</dc:date>
    <item>
      <title>Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199255#M49796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an amount of tables and several IDs and I need to join the IDs to the tables where it is relevant. Therefore I create a table IDS like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="176" style="border: 1px solid #000000; width: 211px; height: 152px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;LVID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;VTID&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;ABSCHLKO&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;ABSCHLKO1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;VT&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;VB&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;(1 means, the ID is relevant, 0 it is not.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created the following code segments:&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct(Name)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into : LVID_RELEVANT separated by ','&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from IDS where LVID=1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct(Name)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into : VTID_RELEVANT separated by ','&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from IDS where VTID=1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far, everything works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I need to check for several tables, if the ID is relevant.&lt;/P&gt;&lt;P&gt;This is what I did:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X="&amp;amp;LVID_RELEVANT.";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp=find(X,cat("ABSCHLKO",','));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put temp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I want to do this for several tables and IDs, I thought about doing this with a macro. I tried the following:&lt;/P&gt;&lt;P&gt;%macro id_relevant(tab= ,id= );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %local result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put "&amp;amp;&amp;amp;&amp;amp;id._RELEVANT.";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp=find("&amp;amp;&amp;amp;&amp;amp;id._RELEVANT.",cat("&amp;amp;tab.",','));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put tmp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput("result",tmp);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;result&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the macro: %id_relevant(tab=ABSCHLKO,id=LVID);&lt;/P&gt;&lt;P&gt;I get the &lt;STRONG&gt;correct result&lt;/STRONG&gt; but the error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any ideas what I did wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199255#M49796</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-11T15:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199256#M49797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;could you please check the log at line 180 and column 322 and see the statements that are causing this error. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199256#M49797</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-03-11T15:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199257#M49798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;General hint when debugging such things:&lt;/P&gt;&lt;P&gt;options mprint symbolgen mlogic; (the last is more critical with lots of macro %if)&lt;/P&gt;&lt;P&gt;%yourmacrocall.&lt;/P&gt;&lt;P&gt;The log will then show the error statement in relation to the resulting line of code generated by the macro.&lt;/P&gt;&lt;P&gt;Most likely cause of your problem: Excess &amp;amp; in the calls unless you actually have a macrovariable LVID_RELEVANT somewhere.&lt;/P&gt;&lt;P&gt;Are you trying to find something in the string "LVID_RELEVANT" ?&lt;/P&gt;&lt;P&gt;If you are only looking to manipulate a single string you might look at the %sysfunc and avoid the data _null_.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199257#M49798</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-11T15:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199258#M49799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure, when I try:&lt;/P&gt;&lt;P&gt;%put %id_relevant(tab=ABSCHLKO,id=LVID);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the error occurs at the statement:&lt;/P&gt;&lt;P&gt;tmp=find("&amp;amp;&amp;amp;&amp;amp;id._RELEVANT.",cat("&amp;amp;tab.",','));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199258#M49799</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-11T15:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199259#M49800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are confusing data step processing with macro processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro id_relevant(tab= ,id= );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %local result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put "&amp;amp;&amp;amp;&amp;amp;id._RELEVANT."; &lt;SPAN style="color: #ff0000;"&gt;This %put is executed by the macro processor BEFORE the data step is compiled!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp=find("&amp;amp;&amp;amp;&amp;amp;id._RELEVANT.",cat("&amp;amp;tab.",',')); &lt;SPAN style="color: #ff0000;"&gt;The find function returns a number! This statement is executed during data step processing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put tmp; &lt;SPAN style="color: #ff0000;"&gt;This %put is also executed by the macro processor BEFORE the data step is compiled!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput("result",tmp); &lt;SPAN style="color: #ff0000;"&gt;This is executed DURING data step processing, placing a number in the macro variable result&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;result &lt;SPAN style="color: #ff0000;"&gt;Here the macro processor replaces &amp;amp;result with the contents of the macro variable result, which happens to be a number; a single number is NOT valid SAS code, causing the error message!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199259#M49800</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T15:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199260#M49801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;180-322 signals a syntax error and is usually placed right under the offending code.&lt;/P&gt;&lt;P&gt;180 and 322 are not row and column numbers in this context.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199260#M49801</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T15:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199261#M49802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the debugging hint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro variable LVID_RELEVANT is created before in the proc sql noprint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I only try to check if the table is listed in the corresponding string....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to do it with %sysfunc directly but since my string contains symbols like ',', I only encountered more/others errors....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199261#M49802</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-11T15:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199262#M49803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You use multiple %sysfunc, one for each function call. So yes it can get messy and may not be the best approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:35:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199262#M49803</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-11T15:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199263#M49804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I removed the % from the put statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the idea of the result as a single number from this macro, which runs perfectly:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/Tips:Check_if_a_variable_exists_in_a_dataset"&gt;http://www.sascommunity.org/wiki/Tips:Check_if_a_variable_exists_in_a_dataset&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro also assigns a value 0 or 1 to the result... Why does it work here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199263#M49804</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-11T15:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199264#M49805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to note, the link you sent is 4 years old, so there maybe better ways of doing things.&amp;nbsp; And you can always check the metadata tables in SAS if you need to see if something exists (SASHELP.VTABLE/VCOLUMN).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199264#M49805</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-11T15:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199265#M49806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably want to replace the simple &amp;amp;result with %put &amp;amp;result;&lt;/P&gt;&lt;P&gt;Still better (IMO) would be to use put tmp=; in the data _null_ step, instead of storing the result in a macro variable with call symput.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199265#M49806</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T15:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199266#M49807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I replaced the &amp;amp;result with %put &amp;amp;result;&lt;/P&gt;&lt;P&gt;Now the macro itself runs without any errors. Thanks for that!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But If I would like to use it, like this:&lt;/P&gt;&lt;P&gt;%if %id_relevant(tab=ABSCHLKO1,id=LVID)=0 %then&lt;/P&gt;&lt;P&gt;inside some code, I get the error:&lt;/P&gt;&lt;P&gt;ERROR: Required operator not found in expression: %id_relevant(tab=ABSCHLKO1,id=LVID)=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What's happening now?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 16:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199266#M49807</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-11T16:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199267#M49808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, NOW you need the "naked" &amp;amp;result so that the result is placed where the macro is called. Just don't expect the macro to work on its own, it needs to be place where the resulting value can be used properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 16:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199267#M49808</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T16:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199268#M49809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, ok. Now I get the point!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 16:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199268#M49809</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-11T16:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199269#M49810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just keep in mind that the principal task of the macro processor is to generate text for feeding back to the "main" SAS interpreter. So some macros may be done for a very specific point in the SAS code, and can not be tested sensibly outside of that situation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 06:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199269#M49810</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-12T06:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro executio: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199270#M49811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, thanks for your time and help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There was still some issue with the data _null_ step and I finally figured out what I did wrong with the %sysfunction. This is the macro now:&lt;/P&gt;&lt;P&gt;%macro id_relevant(tab= ,id= );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %local result;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let result = %sysfunc(find(&amp;amp;&amp;amp;&amp;amp;id._RELEVANT.,%sysfunc(cat(_,&amp;amp;tab.,_))));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;result&lt;/P&gt;&lt;P&gt;%mend id_relevant;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and it is running fine in the process - but as you said, it can't run alone since it returns a single number, but that's fine in this case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2015 08:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-executio-ERROR-180-322-Statement-is-not-valid-or-it-is/m-p/199270#M49811</guid>
      <dc:creator>andreas_schmitz</dc:creator>
      <dc:date>2015-03-12T08:42:02Z</dc:date>
    </item>
  </channel>
</rss>

