<?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: macro name in datafile does not resolve correctly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824575#M325649</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;92 %put &amp;amp;ally;&lt;BR /&gt;"/caslibs/&lt;STRONG&gt;risknoba&lt;/STRONG&gt;/Assessment data for SAS training diario.xlsx"&lt;BR /&gt;93 &lt;BR /&gt;94 proc import datafile= &amp;amp;ally.&lt;BR /&gt;95 /* proc import datafile= '&amp;amp;path.&amp;amp;table..&amp;amp;ext' */&lt;BR /&gt;96 /* proc import datafile="/caslibs/&lt;STRONG&gt;risknb&lt;/STRONG&gt;/Assessment data for SAS training diario.xlsx" */&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just to rule out a trivial reason: The name of the directory is really &lt;FONT face="courier new,courier"&gt;risknoba&lt;/FONT&gt;, not &lt;FONT face="courier new,courier"&gt;risknb&lt;/FONT&gt;?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2022 09:49:52 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2022-07-21T09:49:52Z</dc:date>
    <item>
      <title>macro name in datafile does not resolve correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824566#M325645</link>
      <description>&lt;P&gt;I always struggle with the macro quoting etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's impossible for me to understand its behavior.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use the path without macro concatenation, it works, but using whatever macro construct (single or double quote) it fails.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sess=mysession;
%let caslib=risknoba;
%let table=Assessment data for SAS training diario;
%let ext=xlsx;
%let path=/caslibs/risknoba/;
%let ally="&amp;amp;path.&amp;amp;table..&amp;amp;ext";
cas &amp;amp;sess;
libname caslib cas sessref=&amp;amp;sess;

%put "&amp;amp;path.&amp;amp;table..&amp;amp;ext";
%put &amp;amp;ally;

proc import datafile= &amp;amp;ally.
/* proc import datafile= '&amp;amp;path.&amp;amp;table..&amp;amp;ext' */
/* proc import datafile="/caslibs/risknb/Assessment data for SAS training diario.xlsx" */
out=work.test    
dbms=xlsx    
replace;    
getnames=no;
sheet="Hoja1";
range='B1:D33';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the log info:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 %studio_hide_wrapper;&lt;BR /&gt;82 %let sess=mysession;&lt;BR /&gt;83 %let caslib=risknoba;&lt;BR /&gt;84 %let table=Assessment data for SAS training diario;&lt;BR /&gt;85 %let ext=xlsx;&lt;BR /&gt;86 %let path=/caslibs/risknoba/;&lt;BR /&gt;87 %let ally="&amp;amp;path.&amp;amp;table..&amp;amp;ext";&lt;BR /&gt;88 cas &amp;amp;sess;&lt;BR /&gt;WARNING: A session with the name MYSESSION already exists.&lt;BR /&gt;89 libname caslib cas sessref=&amp;amp;sess;&lt;BR /&gt;NOTE: Libref CASLIB was successfully assigned as follows: &lt;BR /&gt;Engine: CAS &lt;BR /&gt;Physical Name: xxxxxxx&lt;BR /&gt;90 &lt;BR /&gt;91 %put "&amp;amp;path.&amp;amp;table..&amp;amp;ext";&lt;BR /&gt;"/caslibs/risknoba/Assessment data for SAS training diario.xlsx"&lt;BR /&gt;92 %put &amp;amp;ally;&lt;BR /&gt;"/caslibs/risknoba/Assessment data for SAS training diario.xlsx"&lt;BR /&gt;93 &lt;BR /&gt;94 proc import datafile= &amp;amp;ally.&lt;BR /&gt;95 /* proc import datafile= '&amp;amp;path.&amp;amp;table..&amp;amp;ext' */&lt;BR /&gt;96 /* proc import datafile="/caslibs/risknb/Assessment data for SAS training diario.xlsx" */&lt;BR /&gt;97 out=work.test&lt;BR /&gt;98 dbms=xlsx&lt;BR /&gt;99 replace;&lt;BR /&gt;100 getnames=no;&lt;BR /&gt;101 sheet="Hoja1";&lt;BR /&gt;102 range='B1:D33';&lt;BR /&gt;103 run;&lt;BR /&gt;ERROR: Physical file does not exist, /caslibs/risknoba//Assessment data for SAS training diario.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;104 &lt;BR /&gt;105 %studio_hide_wrapper;&lt;BR /&gt;116 &lt;BR /&gt;117&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 09:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824566#M325645</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-07-21T09:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: macro name in datafile does not resolve correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824575#M325649</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;92 %put &amp;amp;ally;&lt;BR /&gt;"/caslibs/&lt;STRONG&gt;risknoba&lt;/STRONG&gt;/Assessment data for SAS training diario.xlsx"&lt;BR /&gt;93 &lt;BR /&gt;94 proc import datafile= &amp;amp;ally.&lt;BR /&gt;95 /* proc import datafile= '&amp;amp;path.&amp;amp;table..&amp;amp;ext' */&lt;BR /&gt;96 /* proc import datafile="/caslibs/&lt;STRONG&gt;risknb&lt;/STRONG&gt;/Assessment data for SAS training diario.xlsx" */&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just to rule out a trivial reason: The name of the directory is really &lt;FONT face="courier new,courier"&gt;risknoba&lt;/FONT&gt;, not &lt;FONT face="courier new,courier"&gt;risknb&lt;/FONT&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 09:49:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824575#M325649</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-07-21T09:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: macro name in datafile does not resolve correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824579#M325651</link>
      <description>&lt;P&gt;OMG&lt;/P&gt;
&lt;P&gt;Shame on me&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 09:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824579#M325651</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-07-21T09:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: macro name in datafile does not resolve correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824672#M325683</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;OMG&lt;/P&gt;
&lt;P&gt;Shame on me&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Next bit: Macro variable references do not resolve inside single quotes. So this&lt;/P&gt;
&lt;PRE&gt;95 /* proc import datafile= '&amp;amp;path.&amp;amp;table..&amp;amp;ext' */&lt;/PRE&gt;
&lt;P&gt;to actually use the macro variables would have to be&lt;/P&gt;
&lt;PRE&gt; proc import datafile= "&amp;amp;path.&amp;amp;table..&amp;amp;ext"&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jul 2022 14:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-name-in-datafile-does-not-resolve-correctly/m-p/824672#M325683</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-21T14:28:37Z</dc:date>
    </item>
  </channel>
</rss>

