Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suspect you have another bug somewhere prior to this statement in your code. Try restarting SAS and executing just those two lines of code and it should work fine, <strong>it worked just fine for me</strong>:</p> <pre><code>%let root = c:\documents and settings\robert.penridge\desktop\mine\sas; %include "&amp;root\lib\work.sas"; </code></pre> <p><strong>EDIT</strong>: This worked for me because I actually added a semicolon. Realised this after @Joe's correct diagnosis of the problem.</p> <p>I created the following folder structure on the desktop:</p> <pre><code>\mine\sas\lib </code></pre> <p>And then put work.sas in there with the following contents:</p> <pre><code>%put blah; </code></pre> <p>When I ran the code the results printed <code>blah</code> just fine with no error messages. In fact I have used code just like this across many versions of SAS and across many operating systems for many years. There's no issue with your code.</p> <p>Contrary to what some of the other answers suggest here, SAS is smart enough to know that the <code>\</code> character can not be part of a macro name so there's no need to explicitly state the end of the macro with the <code>.</code> character.</p> <p>Finally, if you are trying to debug macro code you can also turn on the following options:</p> <pre><code>option mprint mlogic macrogen symbolgen source source2; </code></pre> <p>You can turn them back off like so:</p> <pre><code>option nomprint nomlogic nomacrogen nosymbolgen nosource nosource2; </code></pre> <p>Just be aware that some of these may already be on by default in your SAS environment.</p> <p>In rare circumstances you may also be running into a macro quoting issue. This will happen if you have been using macro functions like <code>%str()</code> <code>%bquote()</code> etc... If this is the case then it can often be resolved by using the <code>%unquote()</code> function around the macro variable that is causing issues. From your code sample it doesn't look like this is the issue but you might have simplified your code for the post. If this were the case then in your situation the code would be changed to look like this:</p> <pre><code>%let root = c:\documents and settings\robert.penridge\desktop\mine\sas; %include "%unquote(&amp;root)\lib\work.sas"; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload