<?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: WARNING: Apparent symbolic reference in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231652#M42168</link>
    <description>What are the values of &amp;amp;lastDeptKey and &amp;amp;lasttoDeptKey and &amp;amp;validToDate just before the macro tries to execute this statement?</description>
    <pubDate>Mon, 26 Oct 2015 15:45:30 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2015-10-26T15:45:30Z</dc:date>
    <item>
      <title>WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231649#M42166</link>
      <description>&lt;P&gt;Good Morning, All.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm a new SAS developer and seem to be hitting a snag with a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting the warnings:&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference LASTDEPTKEY not resolved.&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference LASTTODEPTKEY not resolved.&lt;/P&gt;
&lt;P&gt;and error:&lt;/P&gt;
&lt;P&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;lastDeptKey=&amp;amp;lastToDeptKey or &amp;amp;validToDate="01JAN5999"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let i=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let admUnit=%scan(&amp;amp;admUnits,1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let fice=%scan(&amp;amp;ficeCodes,1);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do %while ( &amp;amp;admUnit &amp;gt; 0 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let x = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let admUnitQry = &amp;amp;admUnit;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do %until ( (&amp;amp;x = 0) or (&amp;amp;x = 50) ) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/*-- Loop through rows in crossing table for the&lt;BR /&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;adm_unit and move to adm units until&lt;BR /&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;the valid to date is '01JAN5999'd &lt;BR /&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;(last adm unit in the group - most current department) --*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;proc sql noprint;&lt;BR /&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;select b.department_key, b.to_department_key, &lt;BR /&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;&amp;nbsp; b.valid_to_date, c.administrative_unit_no&lt;BR /&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;&amp;nbsp; &amp;nbsp;into :lastDeptKey, :lastToDeptKey, :validToDate, :lastAdmUnit&lt;BR /&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;from target.department_dim a, target.dept_key_x_to_dept_key_xing b,&lt;BR /&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;&amp;nbsp; &amp;nbsp; target.department_dim c&lt;BR /&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;where a.administrative_unit_no=&amp;amp;admUnitQry&lt;BR /&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; and a.fice_code=&amp;amp;fice&lt;BR /&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; and a.department_key=b.department_key &lt;BR /&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; and c.department_key=b.to_department_key;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;quit;&lt;BR /&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;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%if &amp;amp;lastDeptKey=&amp;amp;lastToDeptKey or &amp;amp;validToDate="01JAN5999" %then &amp;nbsp;&lt;BR /&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;%let x = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%else %do; &amp;nbsp;&lt;BR /&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;%let x = %eval(&amp;amp;x + 1);&lt;BR /&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;%let admUnitQry = &amp;amp;lastAdmUnit;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* do until most current adm/dept is found */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've used %put statements, but can't seem to find an error. Also, I've checked the datasets that these variables are pulling data from and the data appears good. I figure there's got to be something in the syntax. NOTE: the above isn't _all_ of the macro code, but a snippet that appears relevant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 15:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231649#M42166</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-26T15:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231652#M42168</link>
      <description>What are the values of &amp;amp;lastDeptKey and &amp;amp;lasttoDeptKey and &amp;amp;validToDate just before the macro tries to execute this statement?</description>
      <pubDate>Mon, 26 Oct 2015 15:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231652#M42168</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-26T15:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231655#M42169</link>
      <description>&lt;P&gt;Is it possible that zero observations satisfy the WHERE conditions in the SQL step?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 15:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231655#M42169</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-26T15:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231695#M42177</link>
      <description>%if &amp;amp;lastDeptKey=&amp;amp;lastToDeptKey or &amp;amp;validToDate="01JAN5999" %then  &lt;BR /&gt;&lt;BR /&gt;What value is stored in ValidToDate? My guess is it's a date variable and may not be in the format you expect above so the comparison is invalid. Just a guess though. Have you tried running your macro with MPRINT and SYMBOLGEN on to try and debug it?</description>
      <pubDate>Mon, 26 Oct 2015 17:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231695#M42177</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-10-26T17:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231714#M42180</link>
      <description>&lt;P&gt;Looking at it, yes, that seems very possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess more graceful handling is in order.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 19:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231714#M42180</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-26T19:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231729#M42184</link>
      <description>&lt;P&gt;In this case, it's easy to be graceful.&amp;nbsp; SQL creates an automatic macro variable showing how many records it retrieved.&amp;nbsp; So you can add immediately after the QUIT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;sqlobs=0 %then ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then continue with the other possible conditions currently being tested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 20:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231729#M42184</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-26T20:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231875#M42235</link>
      <description>&lt;P&gt;So, after the Quit statement, something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if &amp;amp;sqlobs=0 %then&lt;BR /&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;%put 'Admin Unit Not Found. Admin Unit:' &amp;amp;admUnitQry 'Fice:' &amp;amp;fice;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%else; &lt;BR /&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;%if &amp;amp;lastDeptKey=&amp;amp;lastToDeptKey or &amp;amp;validToDate="01JAN5999" %then&lt;BR /&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;%let x = 0;&lt;BR /&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;%else %do; &amp;nbsp;&lt;BR /&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;%let x = %eval(&amp;amp;x + 1);&lt;BR /&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;%let admUnitQry = &amp;amp;lastAdmUnit;&lt;BR /&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;%end;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 17:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231875#M42235</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-27T17:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231879#M42239</link>
      <description>&lt;P&gt;I used PUT and found the values of lastDeptKey, lastToDeptKey and validToDate to be empty.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 17:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231879#M42239</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-27T17:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231887#M42242</link>
      <description>&lt;P&gt;What is the overall purpose of this block of code? &amp;nbsp;Why not just process the table by AdmUnit instead of running separate queries for each AdmUnit?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 18:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231887#M42242</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-10-27T18:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231903#M42246</link>
      <description>&lt;P&gt;Look carefully at your logic around this comparison:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;validToDate="01JAN5999" &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the variable that is used to store into the macro variable VALIDTODATE is a date value the result will depend of the format attached. &amp;nbsp;So it could be a string of digits or the string 01JAN5999 or something else if a different format is attached. &amp;nbsp;But it will never have quotes around it like your test is looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to just add the quotes to both sides of the comparison.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"&amp;amp;validToDate"="01JAN5999" &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 19:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231903#M42246</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-10-27T19:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231931#M42251</link>
      <description>&lt;P&gt;Yes ... just remove the semicolon after the lone word %else;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that %PUT does not require quotes to print text. &amp;nbsp;More simply:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%if &amp;amp;sqlobs=0 %then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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;%put Admin Unit Not Found. Admin Unit: &amp;amp;admUnitQry &amp;nbsp;Fice: &amp;amp;fice;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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;%if &amp;amp;lastDeptKey=&amp;amp;lastToDeptKey or &amp;amp;validToDate="01JAN5999" %then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&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;%let x = 0;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then the final %ELSE of course.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If the error persists, we can still get rid of it. &amp;nbsp;But let's see what happens with this much.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Good luck.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 22:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/231931#M42251</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-27T22:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232002#M42263</link>
      <description>&lt;P&gt;When I take the semicolon away from the lone %ELSE statement, and run the code...it seems to go forever. I have to stop the program. That should be the case as there's only about 324 rows it's going through.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the semicolon, it seems to go through them all, but still error out when there's no match.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 14:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232002#M42263</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-28T14:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232022#M42271</link>
      <description>&lt;P&gt;Well, removing the semicolon is the right thing to do.&amp;nbsp; "Going on forever" is a sign that one of your loops (%do %while, or %do %until) doesn't meet its ending condition.&amp;nbsp; At a minimum, change the &amp;amp;SQLOBS logic to look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;sqlobs=0 %then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %let x=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %put ... as before ...;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%else ... as before ...;&lt;/P&gt;
&lt;P&gt;%else ... as before ...;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will guarantee that the interior loop ends.&amp;nbsp; It would be safer to review the exterior loop for the same sort of issue (making sure that it will have an ending).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 14:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232022#M42271</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-28T14:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232042#M42281</link>
      <description>&lt;P&gt;That did the trick, thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro then bombs later at the next reference to &amp;amp;lastAdmUnit as:&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, &lt;BR /&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 missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is looking to create a new table using &amp;amp;lastAdmUnit as adm_unit. I'd think that even if &amp;amp;lastAdmUnit were blank, adm_unit could be create...it'd just be empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 15:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232042#M42281</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-28T15:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232052#M42284</link>
      <description>&lt;P&gt;You can force macro variables to exist.&amp;nbsp; Just add this as the beginning of your macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%local LastAdmUnit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do the same for other macro variables as well ... or you can use %GLOBAL instead of %LOCAL if the macro variables are supposed to remain in existence after your macro finishes executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a couple of cautions, however.&amp;nbsp; First, by forcing the macro variable to exist, that does not change the data within any table or data set.&amp;nbsp; You have to make sure that the SAS code is correct when a blank is substituted for the macro variable reference.&amp;nbsp; Second, if there are zero observations retrieved within an interation of your looping logic, the macro variables will not be blank.&amp;nbsp; Instead, they will remain at whatever value they had from the previous loop iteration.&amp;nbsp; You could force them to be blank by adding at the beginning of your loop:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let LastAdmUnit=;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm losing sight of the result you want, but it sounds like you are getting closer.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 16:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232052#M42284</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-28T16:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232106#M42290</link>
      <description>&lt;P&gt;Perfect!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help me better understand this next time, I recieved the initial warning and error because there was no value due to no match? I would have thought the original if/else statement would have been able to handle it. The first condition wouldn't be met, so it would drop into the second. Why was that not the case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 18:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232106#M42290</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2015-10-28T18:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232107#M42291</link>
      <description>&lt;P&gt;When 0 records satisfy the WHERE condition, SQL doesn't do anything.&amp;nbsp; In particular, it doesn't create your macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After that, SAS sees:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;lastDeptKey=&amp;amp;lastToDeptKey ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks for the macro variables, and they just don't exist.&amp;nbsp; It's not that they have a null value, they just don't exist at all.&amp;nbsp; That's what caused your original error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can always add diagnostic statements, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put _user_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will help give you a feel for how the software is working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, it might have been too big a leap originally to figure out which diagnostic statements to add.&amp;nbsp; Practice will get you there!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 19:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference/m-p/232107#M42291</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-28T19:06:13Z</dc:date>
    </item>
  </channel>
</rss>

