<?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: %TableDrivenMacro -- apparent invocation of macro not resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634244#M188242</link>
    <description>&lt;P&gt;The code that defines the macro can be found at the end of the paper. Copy/paste it into your editor, save it to a file, and %include that file whenever you want to use the macro.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Mar 2020 19:32:32 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-03-23T19:32:32Z</dc:date>
    <item>
      <title>%TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634205#M188230</link>
      <description>&lt;P&gt;Hello Everyone!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I read about a technique called %TableDrivenMacro to repeatedly call a target macro using data from a dataset as the parameters here:&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/102-2008.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/102-2008.pdf&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, whenever I run this macro, I get the following statement:&lt;/P&gt;&lt;P&gt;WARNING: Apparent invocation of macro TABLEDRIVENMACRO not resolved.&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below. I have a flattened dataset (postraw.flatdiscrep) with one unique observation for one row and am trying to make the dataset long.&amp;nbsp;&lt;/P&gt;&lt;P&gt;data postraw.scorelong (keep=encounterid registryid eventid varnum varsort sectionnum varname disclevel varraw varadjud discnote majdenom alldenom);&lt;BR /&gt;length encounterid 8&lt;BR /&gt;varname $255&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;merge postraw.rawrcenc (in=inanalysis keep=encounterid)&lt;BR /&gt;postraw.rawsite (rename=(pacencounterid=encounterid))&lt;BR /&gt;postraw.flatdiscrep&lt;BR /&gt;;&lt;BR /&gt;by encounterid; if inanalysis;&lt;BR /&gt;&lt;BR /&gt;%tabledrivenmacro(Table=Scorevars,&lt;BR /&gt;Macro=Byvarv1,&lt;BR /&gt;Parms=varname varnum varsort sectionnum hasmajoryn hasminoryn parentvar1 parentval1 parentvar2 parentval2 parentvar3 parentva13&lt;BR /&gt;parentvar4 parentval4);&lt;BR /&gt;/* deal with age-dependent */&lt;BR /&gt;if pacagestartd &amp;lt;= 365 then do;&lt;BR /&gt;%tabledrivenmacro(Table=Infant,&lt;BR /&gt;Macro=Byvarv1,&lt;BR /&gt;Parms=varname varnum varsort sectionnum hasmajoryn hasminoryn parentvar1 parentval1 parentvar2 parentval2 parentvar3 parentva13&lt;BR /&gt;parentvar4 parentval4);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an %include statement to reference the Byvarv1 macro. I noticed that discusses %TableDrivenMacro is from 2008, so is it possible that it isn't available in SAS 9.4?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 18:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634205#M188230</guid>
      <dc:creator>lkhadr</dc:creator>
      <dc:date>2020-03-23T18:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: %TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634220#M188237</link>
      <description>&lt;P&gt;You have not defined (or %include-d) the macro named TABLEDRIVENMACRO&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 19:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634220#M188237</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-23T19:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: %TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634241#M188240</link>
      <description>If this is what you need to do, I'd recommend using CALL EXECUTE instead.&lt;BR /&gt;&lt;BR /&gt;Here's an example of how that can work, which seems more straightforward IMO.&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/beb97b1c6d4517dde3b2" target="_blank"&gt;https://gist.github.com/statgeek/beb97b1c6d4517dde3b2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Tom's answer is likely correct, you haven't shown the code for the %macro tabledrivenmacro that would be the macro definition which you have to run before you call the macro itself.&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Mar 2020 19:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634241#M188240</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-23T19:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: %TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634243#M188241</link>
      <description>&lt;P&gt;Hello again!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the Byvarv1 macro I referenced earlier. I run this before I run the %tabledrivenmacro&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro byvarv1(varname&lt;BR /&gt;,varnum&lt;BR /&gt;,varsort&lt;BR /&gt;,sectionnum&lt;BR /&gt;,hasmajoryn&lt;BR /&gt;,hasminoryn&lt;BR /&gt;,parentvar1&lt;BR /&gt;,parentval1&lt;BR /&gt;,parentvar2&lt;BR /&gt;,parentval2&lt;BR /&gt;,parentvar3&lt;BR /&gt;,parentva13&lt;BR /&gt;,parentvar4&lt;BR /&gt;,parentval4);&lt;/P&gt;&lt;P&gt;/* has parent var */&lt;BR /&gt;%if not(%sysevalf(%superq(parentvar1)=,boolean)) %then %do;&lt;BR /&gt;/* parent had no discrepancy */&lt;BR /&gt;if (&amp;amp;parentvar1.lvl = . | &amp;amp;parentvar1.lvl = 0)&lt;BR /&gt;&lt;BR /&gt;%if not(%sysevalf(%superq(parentval1)=,boolean)) %then %do;&lt;BR /&gt;*Boolean expression searches for true/false. True=if the argument, in this case value of the parent field=1 or has a length greater than 0 (character variables).&lt;BR /&gt;It will read something as false if the parent field=0 or has a length of 0.;&lt;BR /&gt;&amp;amp; &amp;amp;parentvar1 = "&amp;amp;parentval1"&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%if not(%sysevalf(%superq(parentvar2)=,boolean)) %then %do;&lt;BR /&gt;&amp;amp; (&amp;amp;parentvar2.lvl = . | &amp;amp;parentvar2.lvl = 0)&lt;BR /&gt;&amp;amp; not(missing(&amp;amp;parentvar2))&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%if not(%sysevalf(%superq(parentval2)=,boolean)) %then %do;&lt;BR /&gt;&amp;amp; &amp;amp;parentvar2 = "&amp;amp;parentval2"&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%if not(%sysevalf(%superq(parentvar3)=,boolean)) %then %do;&lt;BR /&gt;/* parent had no discrepancy */&lt;BR /&gt;&amp;amp; (&amp;amp;parentvar3.lvl = . | &amp;amp;parentvar3.lvl = 0)&lt;BR /&gt;&amp;amp; not(missing(&amp;amp;parentvar3))&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%if not(%sysevalf(%superq(parentva13)=,boolean)) %then %do;&lt;BR /&gt;&amp;amp; &amp;amp;parentvar3 = "&amp;amp;parentval3"&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%if not(%sysevalf(%superq(parentvar4)=,boolean)) %then %do;&lt;BR /&gt;if (&amp;amp;parentvar4.lvl = . | &amp;amp;parentvar4.lvl = 0)&lt;BR /&gt;&amp;amp; not(missing(&amp;amp;parentvar4))&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%if not(%sysevalf(%superq(parentval4)=,boolean)) %then %do;&lt;BR /&gt;&amp;amp; &amp;amp;parentvar4 = "&amp;amp;parentval4"&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;then do;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;if &amp;amp;varname.lvl in (.,0,1,2) then do;&lt;BR /&gt;/* has major */&lt;BR /&gt;%if &amp;amp;hasmajoryn = 1 %then %do;&lt;BR /&gt;majdenom = 1;&lt;BR /&gt;alldenom = 1;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;majdenom = 0;&lt;BR /&gt;%if &amp;amp;hasMinorYN=1 %then %do;&lt;BR /&gt;alldenom=1;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do; alldenom=0; %end;&lt;BR /&gt;%end;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;else if not(missing(&amp;amp;varname.lvl)) then do;&lt;BR /&gt;majdenom = 0;&lt;BR /&gt;alldenom = 0;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;varname = "&amp;amp;varname";&lt;BR /&gt;varnum = &amp;amp;varnum;&lt;BR /&gt;varsort = &amp;amp;varsort;&lt;BR /&gt;sectionnum = &amp;amp;sectionnum;&lt;BR /&gt;disclevel = &amp;amp;varname.lvl;&lt;BR /&gt;if not(missing(&amp;amp;varname.rc)) then varraw = &amp;amp;varname.rc;&lt;BR /&gt;else varraw = &amp;amp;varname;&lt;BR /&gt;varadjud = &amp;amp;varname.aud;&lt;BR /&gt;discnote = &amp;amp;varname.nte;&lt;BR /&gt;output;&lt;/P&gt;&lt;P&gt;%if not(%sysevalf(%superq(parentvar1)=,boolean)) %then %do;&lt;BR /&gt;end;&lt;BR /&gt;%end;&lt;BR /&gt;end;&lt;BR /&gt;%mend;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 19:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634243#M188241</guid>
      <dc:creator>lkhadr</dc:creator>
      <dc:date>2020-03-23T19:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: %TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634244#M188242</link>
      <description>&lt;P&gt;The code that defines the macro can be found at the end of the paper. Copy/paste it into your editor, save it to a file, and %include that file whenever you want to use the macro.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 19:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634244#M188242</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-23T19:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: %TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634248#M188243</link>
      <description>&lt;P&gt;You need the similar macro definition for %tabledrivenmacro. It's not built into SAS it's something a user wrote and if you want to use it, you need to use their code as well and you need to provide that code to use it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 19:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634248#M188243</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-23T19:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: %TableDrivenMacro -- apparent invocation of macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634261#M188245</link>
      <description>&lt;P&gt;Thank you SO MUCH!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 20:11:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TableDrivenMacro-apparent-invocation-of-macro-not-resolved/m-p/634261#M188245</guid>
      <dc:creator>lkhadr</dc:creator>
      <dc:date>2020-03-23T20:11:46Z</dc:date>
    </item>
  </channel>
</rss>

