<?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: %Scan function error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191288#M36117</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does not pass the VALUE of testValue variable to the macro, it passes the TEXT value "testValue";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Oct 2014 15:29:33 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2014-10-20T15:29:33Z</dc:date>
    <item>
      <title>%Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191280#M36109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%MACRO FIND_CLOSEST_VALUE(limOrDedOption,limorDedValue);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET numOptions = %Sysfunc(Countw(&amp;amp;limOrDedOption.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; limOrDedSetFlag = 'N';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %DO curLimOrDed = 1 %TO &amp;amp;numOptions.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF limOrDedSetFlag = 'N" AND &amp;amp;curlimOrDed &amp;gt; 1 THEN DO;&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; lwrVal = %Scan(&amp;amp;limOrDedOption., &amp;amp;curLimOrDed. - 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uprVal = %Scan(&amp;amp;limOrDedOption., &amp;amp;curLimOrDed.);&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; IF &amp;amp;limOrDedValue. &amp;lt; uprVal THEN DO;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (&amp;amp;limOrDedValue. - lwrVal)/(uprVal - lwrVal) &amp;lt; 0.5 THEN &amp;amp;limOrDedValue = lwrVal;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE &amp;amp;limOrDedValue = uprVal;&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; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %END;&lt;/P&gt;&lt;P&gt;%MEND;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Receiving an error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prevLimOrDed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Argument 2 to macro function %SCAN is not a number.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;Error occurs on the lwrVal. uprVal is fine. It's almost as if the if condition is not met on the &amp;amp;curLirOrDed &amp;gt; 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:41:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191280#M36109</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T14:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191281#M36110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we see the relevant portions of the code that you used to call this macro?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191281#M36110</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2014-10-20T14:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191282#M36111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried:&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; lwrVal = %Scan(&amp;amp;limOrDedOption., %eval(&amp;amp;curLimOrDed. - 1));&lt;/P&gt;&lt;P&gt;If so maybe put options mlogic mprint symbolgen; on and see what the macro variables resolve to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191282#M36111</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-20T14:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191283#M36112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%LET numArray = 200000 300000 500000 1000000 2000000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET inforce;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %FIND_CLOSEST_VALUE(&amp;amp;numArray, testValue);&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191283#M36112</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191284#M36113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes, I tried %eval and i tried put(&amp;amp;curLimOrDed,1.) - 1. I am receiving the exact same error =(&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191284#M36113</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T14:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191285#M36114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, couple of things:&lt;/P&gt;&lt;P&gt;- You have a typo in the macro, IF limOrDedSetFlag = 'N" AND - double quotes after the N.&lt;/P&gt;&lt;P&gt;- Secondly you only want to do the %do loop from 2 to numoptions, other 1 with -1 = 0 which is an invalid scan array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, can't actually test this as no data provided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So change: %DO curLimOrDed = 2 %TO &amp;amp;numOptions.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191285#M36114</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-20T15:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191286#M36115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For some reason cannot copy paste in this editor. I typed 'N" up, it is actually a 'N'.&lt;/P&gt;&lt;P&gt;As for the second comment, I have a condition to execule when &amp;amp;curLimOrDed = 1 and when &amp;amp;curLimOrDed &amp;gt; 1. The&lt;/P&gt;&lt;P&gt;%Scan(&amp;amp;limOrDedOption, &amp;amp;curLimOrDed. -1 ) executes only when :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF limOrDedSetFlag = 'N" AND &amp;amp;curlimOrDed &amp;gt; 1 THEN DO;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191286#M36115</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T15:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191287#M36116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, another thought, what is the prevLimOrDed, mentioned in the error message, I don't see this in the macro or code.&amp;nbsp; Also, have you tried putting options mlogic mprint symbolgen; on and seeing what is being generated?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191287#M36116</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-20T15:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191288#M36117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does not pass the VALUE of testValue variable to the macro, it passes the TEXT value "testValue";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191288#M36117</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-20T15:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191289#M36118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;testValue is actually a dataset column. The macro should check what the value in the testValue column is.&lt;/P&gt;&lt;P&gt;For example, say the value is 60, but acceptable values are 50 and 100.&lt;/P&gt;&lt;P&gt;The macro calculates if 60 is closer to 50 or 100, and based on that, resets the testValue to 50.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191289#M36118</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T15:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191290#M36119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The prevLimOrDed was me testing. sorry, removed it, still getting an error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 16:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191290#M36119</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T16:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191291#M36120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps start again, post the actual code (including call), the actual log text with the error, and if possible some test data which triggers the error.&amp;nbsp; Will have a look tomorrow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 17:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191291#M36120</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-20T17:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191292#M36121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MARY9999: Do you have to use a macro for this? It can be done easily within a datastep. E.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET sashelp.class (rename=(age=testValue));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array limOrDedOption(8) _temporary_ (10.4,11.6,12.4,13.6,14.4,15.6,16.4,17.6);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _n_=2 to dim(limOrDedOption);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if limOrDedOption(_n_) ge testValue then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if testValue+(limOrDedOption(_n_)-limOrDedOption(_n_-1))/2 gt limOrDedOption(_n_)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then closest=limOrDedOption(_n_);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else closest=limOrDedOption(_n_-1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; leave;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if _n_ eq dim(limOrDedOption) then closest=limOrDedOption(_n_);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 18:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191292#M36121</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-20T18:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191293#M36122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ideally yes, i have t odo this for 20 different variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 18:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191293#M36122</guid>
      <dc:creator>MARY9999</dc:creator>
      <dc:date>2014-10-20T18:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191294#M36123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would agree with Arthur, arrays are easier for lots of variables as you can then apply the same logic across any number of variables, something like:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; infile datalines dlm=',';&lt;BR /&gt;&amp;nbsp; input var1 var2 var3 range1 range2 range3 range4;&lt;BR /&gt;datalines;&lt;BR /&gt;10,30,15,12,8,14,19&lt;BR /&gt;20,35,15,12,8,14,19&lt;BR /&gt;16,30,17,12,8,14,19&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; array vars{3} 8. var1 var2 var3;&lt;BR /&gt;&amp;nbsp; array range{4} 8. range1-range4;&lt;BR /&gt;&amp;nbsp; array res{3} 8.;&lt;BR /&gt;&amp;nbsp; do i=1 to 3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j=2 to 4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if range{j-1} &amp;lt;= vars{i} &amp;lt;= range{j} then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (vars{i}-range{j-1}) / (range{j}-range{j-1}) &amp;lt; 0.5 then res{i}=range{j-1};&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2014 08:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191294#M36123</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-21T08:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191295#M36124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;there are different Errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;the macro does not do, what is intended. The limOrDedSetFlag was not changed, in the loop, if the Operation was succesfull. So always writes the next loop over the result of the previous loop.&lt;/LI&gt;&lt;LI&gt;the Expression "&amp;amp;curLimOrDed. - 1" in the %scan-function must be "%eval(&amp;amp;curLimOrDed. - 1)"&lt;/LI&gt;&lt;LI&gt;The test is very complicated. Why do you not simply compare the differences from&amp;nbsp; limorDedValue to lower bound and upper bound.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: navy; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%MACRO&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; FIND_CLOSEST_VALUE(limOrDedOption,limorDedValue);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; numOptions = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Sysfunc&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(Countw(&amp;amp;limOrDedOption.,&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%str&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;( )));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedSetFlag = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;'N'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: green; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;/* probe of less or equal as the smallest value */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;if &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Scan&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedOption.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;,&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%str&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;( )) then do;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Scan&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedOption.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;,&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%str&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;( ));&lt;/SPAN&gt;&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;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedSetFlag = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: green; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;/* probe of equal or greater as the highest value */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;else if &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Scan&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedOption.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, -&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;,&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%str&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;( )) then do;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;amp;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Scan&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedOption.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, -&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;,&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%str&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;( ));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedSetFlag = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;else do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: green; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;/* the value must be between 2 values or equal a value of the list*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%DO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; curLimOrDed = &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;2 &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%TO&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;numOptions.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp; IF limOrDedSetFlag = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;'N'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; THEN DO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwrVal =&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Scan&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedOption.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;curLimOrDed.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; - &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uprVal =&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%Scan&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedOption.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;curLimOrDed.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (lwrval &amp;lt;= &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.)&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; and (&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.)&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; &amp;lt;= uprVal THEN DO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; - lwrVal) &amp;lt; (uprVal - &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; = lwrVal;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;ELSE&amp;nbsp; &amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;limOrDedValue.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; = uprVal;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; limOrDedSetFlag = &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp; %END&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: navy; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%MEND&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: green; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;/* usage */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&lt;BR /&gt;numArray = 200000 300000 500000 1000000 2000000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;options&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;mprint&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: navy; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;DATA &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;testvalue1=&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;34000&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;testvalue2= &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;340000&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;testvalue3=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;3400000&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; %&lt;STRONG&gt;&lt;EM&gt;FIND_CLOSEST_VALUE&lt;/EM&gt;&lt;/STRONG&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;numArray.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, testValue1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; %&lt;STRONG&gt;&lt;EM&gt;FIND_CLOSEST_VALUE&lt;/EM&gt;&lt;/STRONG&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;numArray.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, testValue2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt; %&lt;STRONG&gt;&lt;EM&gt;FIND_CLOSEST_VALUE&lt;/EM&gt;&lt;/STRONG&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;numArray.&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN-US;"&gt;, testValue3);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2014 15:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191295#M36124</guid>
      <dc:creator>jh_ti_bw</dc:creator>
      <dc:date>2014-10-21T15:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: %Scan function error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191296#M36125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I still think that using arrays in a datastep would be your best solution but, based on the code offered by jh-ti-bw, here is one way that you could do it using a macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro FIND_CLOSEST_VALUE(limOrDedOption,limorDedValue);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let numOptions = %Sysfunc(Countw(&amp;amp;limOrDedOption.,%str( )));&lt;/P&gt;&lt;P&gt;&amp;nbsp; limOrDedSetFlag = 'N';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* probe of less or equal as the smallest value */&lt;/P&gt;&lt;P&gt;&amp;nbsp; if &amp;amp;limOrDedValue. &amp;lt;= %Scan(&amp;amp;limOrDedOption., 1,%str( )) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwrVal = %Scan(&amp;amp;limOrDedOption., 1,%str( ));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uprVal = %Scan(&amp;amp;limOrDedOption., 1,%str( ));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; limOrDedSetFlag = 'Y';&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* probe of equal or greater as the highest value */&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if &amp;amp;limOrDedValue. &amp;gt;= %Scan(&amp;amp;limOrDedOption., -1,%str( )) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwrVal = %Scan(&amp;amp;limOrDedOption., -1,%str( ));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uprVal = %Scan(&amp;amp;limOrDedOption., -1,%str( ));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; limOrDedSetFlag = 'Y';&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* the value must be between 2 values or equal a value of the list*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do curLimOrDed = 2 %to &amp;amp;numOptions.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if limOrDedSetFlag = 'N' THEN DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwrVal =%Scan(&amp;amp;limOrDedOption., %eval(&amp;amp;curLimOrDed. - 1));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uprVal =%Scan(&amp;amp;limOrDedOption., &amp;amp;curLimOrDed.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (lwrval &amp;lt;= &amp;amp;limOrDedValue.) and (&amp;amp;limOrDedValue.) &amp;lt;= uprVal THEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; limOrDedSetFlag = 'Y';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; if lwrVal eq uprVal then closest=lwrVal;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if &amp;amp;limOrDedValue.+(uprVal-lwrVal)/2 gt uprVal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then closest=uprVal;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else closest=lwrVal;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; drop lwrVal uprVal limOrDedSetFlag;&lt;/P&gt;&lt;P&gt;%mend FIND_CLOSEST_VALUE;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* usage */&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input testvalue1 testvalue2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;34000&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/P&gt;&lt;P&gt;249000&amp;nbsp;&amp;nbsp; 24&lt;/P&gt;&lt;P&gt;249999&amp;nbsp;&amp;nbsp; 25&lt;/P&gt;&lt;P&gt;250000&amp;nbsp;&amp;nbsp; 26&lt;/P&gt;&lt;P&gt;250001&amp;nbsp;&amp;nbsp; 30&lt;/P&gt;&lt;P&gt;251000&amp;nbsp;&amp;nbsp; 31&lt;/P&gt;&lt;P&gt;340000&amp;nbsp;&amp;nbsp; 35&lt;/P&gt;&lt;P&gt;1400000&amp;nbsp; 40&lt;/P&gt;&lt;P&gt;2400000&amp;nbsp; 44&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %FIND_CLOSEST_VALUE(200000 300000 500000 1000000 2000000, testValue1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; closest1=closest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %FIND_CLOSEST_VALUE(15 20 22 24 26 28 30 32 34 36 38 41, testValue2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; closest2=closest;&lt;/P&gt;&lt;P&gt;&amp;nbsp; drop closest;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2014 18:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-function-error/m-p/191296#M36125</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-21T18:15:44Z</dc:date>
    </item>
  </channel>
</rss>

