I suspect you have another error somewhere before this statement in your code. Try restarting SAS and executing only these two lines of code, and it should work fine, it worked fine for me :
%let root = c:\documents and settings\robert.penridge\desktop\mine\sas; %include "&root\lib\work.sas";
EDIT : this worked for me because I actually added a semicolon. I realized this after @Joe correctly diagnosed the problem.
I created the following folder structure on the desktop:
\mine\sas\lib
Then add work.sas with the following content:
%put blah;
When I ran the code, the results printed blah just fine, with no error messages. In fact, I used the code in the same way as it has in many versions of SAS and in many operating systems for many years. No problem with your code.
Unlike some other answers, SAS is smart enough to know that the \ character cannot be part of the macro name, so there is no need to explicitly indicate the end of the macro with . .
Finally, if you are trying to debug macro code, you can also enable the following options:
option mprint mlogic macrogen symbolgen source source2;
You can disable them like this:
option nomprint nomlogic nomacrogen nosymbolgen nosource nosource2;
Just keep in mind that some of them may already be enabled by default in your SAS environment.
In rare cases, you may also encounter a macro problem. This will happen if you use macro functions like %str() %bquote() , etc. If so, this can often be resolved with the %unquote() function around the macro variable causing the problem. From your sample code, this doesn't seem like a problem, but you could simplify your code for the message. If so, then in your situation the code will be changed to look like this:
%let root = c:\documents and settings\robert.penridge\desktop\mine\sas; %include "%unquote(&root)\lib\work.sas";