0

This is the first step which would be used throughout all the project later:

(a) Create a macro variable using a %LET statement called ‘directory'where you can type the name of the directory that contains all the files of interest for this project.

(b) Create a temporary library called ‘datapath’ that links to this directory in part (a)

my code:

%let directory = C:\users\downloads;    
%LET directory = 'C:\users\Downloads';     
Libname datapath &directory.;    
run;
Joe
  • 62,789
  • 6
  • 49
  • 67
DUKEANDY
  • 1
  • 1
  • What is your question? How to do (a) and (b)? What did you tried so far? Please edit your question. – jogo Dec 06 '15 at 18:08
  • thx for advice! already edited it, have any idea about it ? – DUKEANDY Dec 07 '15 at 01:40
  • Welcome to Stack Overflow. You appear to have defined 'directory' twice, in your question at least and the 'run' statement would not be necessary at that point. If you're just not sure if your code works try it and if it doesn't work you might get a message that will help you resolve your problem, in which case post your answer to help others who are in a similar situation. If you still cannot resolve your problem then edit the question again to show what message you received. Also, consider first using: 'options symbolgen mprint;' which should show you what your macro code resolves to. – Amir Dec 07 '15 at 08:23

2 Answers2

2

in SAS 9.3 the following works:

%let libtest = test;                   /* &libtest   --> name of library */   
%LET directory = 'C:\users\Downloads'; /* &directory --> location on disk */
%let table = table;                    /* &table     --> name of dataset in library test  */
Libname &libtest &directory;

To test:

data &libtest..&table;
x=0;
run;
DCR
  • 14,737
  • 12
  • 52
  • 115
0

I don't really know what your question is, but if you are having issues, try using double quotes instead of single quotes. That works for me sometimes. Also, you created a macro variable called directory, then immediately overwrote it. You also don't need that "run;" statement at the end.

Jonathan Wilson
  • 626
  • 6
  • 14