<?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: A character operand was found in the %EVAL function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294292#M61382</link>
    <description>&lt;P&gt;PS a much better solution:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dir pipe "dir &amp;amp;subdir.*.xls /B";
data new;
infile dir truncover end=last;
input filename $100.;
length dsn $100;
filename=cats("&amp;amp;subdir",filename);
dsn = scan(scan(filename,6,'\'),1,'.');
call execute('proc import datafile="'!!trim(filename)!!'" out='!!trim(dsn)!!' dbms=excel replace; getnames=yes; mixed=yes; run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 26 Aug 2016 07:34:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-08-26T07:34:03Z</dc:date>
    <item>
      <title>A character operand was found in the %EVAL function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294276#M61378</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following macro that I found online to import all the xls contained in a folder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options validvarname=any;&lt;/P&gt;&lt;P&gt;%let subdir=G:\xxxxxxt\;&lt;BR /&gt;filename dir pipe "dir &amp;amp;subdir.*.xls /B";&lt;BR /&gt;data new;&lt;BR /&gt;infile dir truncover end=last;&lt;BR /&gt;input filename $100.;&lt;BR /&gt;filename=cats("&amp;amp;subdir",filename);&lt;BR /&gt;call symputx(cats('path',_n_),filename);&lt;BR /&gt;call symputx(cats('dsn',_n_),scan(scan(filename,6,'\'),1,'.'));&lt;BR /&gt;if last then call symputx('nobs',_n_);&lt;BR /&gt;run;&lt;BR /&gt;%put _user_;&lt;BR /&gt;%macro import;&lt;BR /&gt;%do i=1 %to &amp;amp;nobs;&lt;BR /&gt;proc import datafile="&amp;amp;&amp;amp;path&amp;amp;i" out=&amp;amp;&amp;amp;dsn&amp;amp;i dbms=excel replace;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;mixed=yes;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend import;&lt;/P&gt;&lt;P&gt;%import&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I get the error message in the attached picture.&lt;/P&gt;&lt;P&gt;Readin some post on the topic I assume that the problem is related to the variable NOBS... why the symbolic reference is not resolved. How should I debug it? Thank in adcance, SH.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12885iDCDB86974DEABBB4/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;</description>
      <pubDate>Fri, 26 Aug 2016 06:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294276#M61378</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-08-26T06:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294279#M61379</link>
      <description>&lt;P&gt;Problem is below statement did not executed in your code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if last then call symputx('nobs',_n_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please share the full log.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 07:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294279#M61379</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-08-26T07:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294291#M61381</link>
      <description>&lt;P&gt;When doing this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dir pipe "dir &amp;amp;subdir.*.xls /B";
data new;
infile dir truncover end=last;
input filename $100.;
filename=cats("&amp;amp;subdir",filename);
call symputx(cats('path',_n_),filename);
call symputx(cats('dsn',_n_),scan(scan(filename,6,'\'),1,'.'));
if last then call symputx('nobs',_n_);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if the directory is empty, the data step will stop in the first iteration at the infile statement (which actually is a "read from infile"), and never reach the call symputs.&lt;/P&gt;
&lt;P&gt;Put the "if last ...." line before the infile statement and see what happens.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 07:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294291#M61381</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-26T07:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294292#M61382</link>
      <description>&lt;P&gt;PS a much better solution:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dir pipe "dir &amp;amp;subdir.*.xls /B";
data new;
infile dir truncover end=last;
input filename $100.;
length dsn $100;
filename=cats("&amp;amp;subdir",filename);
dsn = scan(scan(filename,6,'\'),1,'.');
call execute('proc import datafile="'!!trim(filename)!!'" out='!!trim(dsn)!!' dbms=excel replace; getnames=yes; mixed=yes; run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 07:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function/m-p/294292#M61382</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-26T07:34:03Z</dc:date>
    </item>
  </channel>
</rss>

