<?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: ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413727#M101294</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30622"&gt;@gamotte&lt;/a&gt;&amp;nbsp;has pointed you in the right direction.&amp;nbsp; More specifically, note that your call to the macro will generate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where codetype="hcpcs" and flagtype="biopsy";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is likely that your CODES data set contains different values, such as "HCPCS" instead of "hcpcs" or "Biopsy" instead of "biopsy".&amp;nbsp; SAS is looking for exact matches to the values in quotes.&amp;nbsp; You can call the macro slightly differently, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%flag(HCPCS, Biopsy);&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 16:30:34 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-11-15T16:30:34Z</dc:date>
    <item>
      <title>ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413701#M101285</link>
      <description>&lt;P&gt;Hi, I’m trying to run the following macro from this SAS support paper on flagging healthcare claims using SAS 9.4 (TS1M3)(&lt;A href="https://support.sas.com/resources/papers/proceedings15/1340-2015.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings15/1340-2015.pdf&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro flag(codetype, flagtype);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select quote(code)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :codelist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; separated by "," from CODES&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; codetype="&amp;amp;codetype" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flagtype="&amp;amp;flagtype";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;data CLAIMS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set CLAIMS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if &amp;amp;codetype.1 in (&amp;amp;codelist)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then _&amp;amp;flagtype=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%flag(hcpcs, biopsy); *flag biopsy;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have my datasets (CLAIMS and CODES) set up as specified in the paper with the only notable difference being my data contains multiple claims per patient; but I'm not sure this should matter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I keep getting the following error when I try running the code and have tried the almost all suggestions for ERROR 22-322 listed in SAS community posts. None of them have resolved this error. Does anyone know what is wrong with this code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS log after I run this macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2653 options MLOGIC;&lt;/P&gt;&lt;P&gt;2654 %flag(hcpcs, biopsy);&lt;/P&gt;&lt;P&gt;MLOGIC(FLAG): Beginning execution.&lt;/P&gt;&lt;P&gt;MLOGIC(FLAG): Parameter CODETYPE has value hcpcs&lt;/P&gt;&lt;P&gt;MLOGIC(FLAG): Parameter FLAGTYPE has value biopsy&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable CODETYPE resolves to hcpcs&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable FLAGTYPE resolves to biopsy&lt;/P&gt;&lt;P&gt;NOTE: No rows were selected.&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable CODETYPE resolves to hcpcs&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "FLAG".&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;amp;codelist)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then _flagtype=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;WARNING: Apparent symbolic reference CODELIST not resolved.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string,&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a numeric constant, a datetime constant, a missing value, iterator, (.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 15:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413701#M101285</guid>
      <dc:creator>mles</dc:creator>
      <dc:date>2017-11-15T15:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413713#M101288</link>
      <description>&lt;P&gt;There is no row in your dataset that satisfies the condition :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where codetype="&amp;amp;codetype" and flagtype="&amp;amp;flagtype";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As indicated in the log :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: No rows were selected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add a test :&lt;/P&gt;
&lt;P&gt;%if %symexist(codelist) %then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;...&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%else %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %put WARNING: NO ROW SATISFIES THE CONDITION...&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 16:05:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413713#M101288</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-11-15T16:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413727#M101294</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30622"&gt;@gamotte&lt;/a&gt;&amp;nbsp;has pointed you in the right direction.&amp;nbsp; More specifically, note that your call to the macro will generate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where codetype="hcpcs" and flagtype="biopsy";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is likely that your CODES data set contains different values, such as "HCPCS" instead of "hcpcs" or "Biopsy" instead of "biopsy".&amp;nbsp; SAS is looking for exact matches to the values in quotes.&amp;nbsp; You can call the macro slightly differently, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%flag(HCPCS, Biopsy);&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 16:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413727#M101294</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-15T16:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413740#M101300</link>
      <description>&lt;P&gt;Thank you! You and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30622"&gt;@gamotte&lt;/a&gt;'s suggestions resolved this issue.&lt;/P&gt;&lt;P&gt;It seems to have been a matter of letter case in the CODES data set.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 17:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413740#M101300</guid>
      <dc:creator>mles</dc:creator>
      <dc:date>2017-11-15T17:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413754#M101306</link>
      <description>&lt;P&gt;You can adapt the macro so that you will be independent of case letters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro flag(codetype, flagtype);
  %let codetyep = %upcase(&amp;amp;codetype);  /* line added */
  %let flagtype = %upcase(&amp;amp;flagtype);      /* line added */

   proc sql;
      select quote(code)
         into :codelist
            separated by "," from CODES
              where
                 codetype="&amp;amp;codetype" and
                 flagtype="&amp;amp;flagtype";
   quit;
   %let codelist = %upcase(&amp;amp;codelist);     /* line added */

data CLAIMS;
   set CLAIMS;
      if &amp;amp;codetype.1 in (&amp;amp;codelist)
         then _&amp;amp;flagtype=1;
           run;
    %mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Nov 2017 17:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413754#M101306</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-11-15T17:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322 /  WARNING: Apparent symbolic reference CODELIST not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413771#M101308</link>
      <description>&lt;P&gt;The error is because your SQL query got no hits and so it did not create the macro variable.&lt;/P&gt;
&lt;P&gt;You could code for that by setting some default value into the macro variable before the query.&amp;nbsp; Or you could define the macro variable as LOCAL will insure that it exists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the cause was that your supplied values did not match the case of the data then&amp;nbsp;you could update the macro slightly so that users do not need to provide exact case of text that you are searching for,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro flag(codetype, flagtype);
%local codelist;
proc sql;
select quote(trim(code))
  into :codelist separated by ' ' 
  from CODES
  where upcase(codetype)=%upcaase("&amp;amp;codetype")
    and upcase(flagtype)=%upcase("&amp;amp;flagtype")
;
quit;

data CLAIMS;
  set CLAIMS;
  if &amp;amp;codetype.1 in (&amp;amp;codelist) then _&amp;amp;flagtype=1;
run;
%mend flag;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 18:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-WARNING-Apparent-symbolic-reference-CODELIST-not/m-p/413771#M101308</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-15T18:49:20Z</dc:date>
    </item>
  </channel>
</rss>

