From: cael on
Hi,

I'm trying to let final user enter the directory location at the
beginning of the code instead of re-writing it all over the place. I
have another text file that reads into the code as well which might be
causing the problem. I've pasted a snippet below. Any insight is
appreciated.



%let folderlocation = \\abcd\My Documents\; /* this is where the user
enters the folder location*/

libname lib_x '"&folderlocation"';
libname output_x "&folderlocation\output_x";

%include "&folderlocation\data\macro01.sas" ;
%include "&folderlocation\data\macro02.sas" ;
%let variablelist= &folderlocation\input\variablelist.txt;
infile "&folderlocation\input\variables.txt";
From: Ya on
On Jul 22, 5:21 am, cael <lunacae...(a)gmail.com> wrote:
> Hi,
>
> I'm trying to let final user enter the directory location at the
> beginning of the code instead of re-writing it all over the place. I
> have another text file that reads into the code as well which might be
> causing the problem.  I've pasted a snippet below. Any insight is
> appreciated.
>
> %let folderlocation = \\abcd\My Documents\;     /* this is where the user
> enters the folder location*/
>
> libname lib_x '"&folderlocation"';
> libname output_x "&folderlocation\output_x";
>
> %include "&folderlocation\data\macro01.sas" ;
> %include "&folderlocation\data\macro02.sas" ;
> %let variablelist= &folderlocation\input\variablelist.txt;
>         infile "&folderlocation\input\variables.txt";

So what's the question?
From: Tom Abernathy on
You can make your code easier by pointing a FILEREF at the folder that
is storing text files like raw data or programs.
For example:

* Set folder location here ;
%let folderlocation = \\abcd\My Documents\;

* Set input variable list here ;
%let variablelist=My Vars.txt;

* Define input and output librefs and filerefs ;

libname output "&folderlocation\output_x";
libname input "&folderlocation\input" access=readonly;
filename sascode "&folderlocation\data";
filename input "&folderlocation\input";

%inc sascode(macro01);
%inc sascode("macro02.sas");

data .... ;
infile input("&variablelist") ...... ;
....
run;



From: Patrick on
%let folderlocation = \\abcd\My Documents\; -> ends with a backslash;

libname output_x "&folderlocation\output_x"; .> adds another
backslash

The resolved path in the libname statement will be: \\abcd\My Documents
\\output_x
-> the doubled backslash after "My Documents" will cause issues

HTH
Patrick