Posted By

webonomic on 02/26/10


Tagged

file path dynamic libname


Versions (?)

Retrieve the physical location of a dynamic dataset, file or folder in SAS


 / Published in: SAS
 

URL: http://caloxy.com/papers/78WholePath.pdf

The PATHNAME function can be used to retrieve the physical location of a file or directory. This can be especially useful when reassigning engines for a libref using the Macro Language.

Here we want to write a Version 6 copy of the data set CLASS to the same location as the MYDATA library, however in order to issue a new LIBNAME statement we need to know the location of the MYDATA library. The PATHNAME function returns this location and the new libref (MYDAT6) can be created.

  1. data mydata.class;
  2. set sashelp.class;
  3. run;
  4.  
  5. libname mydat6 v6 "%sysfunc(pathname(mydata))";
  6.  
  7. data mydat6.class6;
  8. set mydata.class;
  9. run;

Report this snippet  

You need to login to post a comment.