Date: Mon, 17 May 2004 17:42:38 -0400
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Re: How to set up libnames and filenames with a twist
On Mon, 17 May 2004 16:28:16 -0500, Kevin F. Spratt <kevin-
spratt@UIOWA.EDU> wrote:
>I currenly ise libnames and filenames to indicate the locations for:
>
>1) My SAS permanent data sets, (i.e, LIBNAME SAVE),
>2) my format library for the project (i.e., LIBNAME LIBRARY),
>3) Any input data sets (e.g., an excel file such as FILENAME EXCEL1),
>4) My program log (i.e., FILENAME LOG),
>5) My program output (i.e., FILENAME OUT),
>6) My program program (i.e., FILENAME PGM)
>
>LIBNAME SAVE 'E:\ORTHO\PROJECTS\ZA\SPONDY\DAT';
>
>LIBNAME LIBRARY
>'E:\ORTHO\PROJECTS\ZA\SPONDY\FOR';
>
>FILENAME
>EXCEL1 'E:\ORTHO\PROJECTS\ZA\SPONDY\DAT\XRAYTAB1.XLS';
>
>FILENAME
>LOG 'E:\ORTHO\PROJECTS\ZA\SPONDY\LOG\entry1.p01';
>
>FILENAME
>OUT 'E:\ORTHO\PROJECTS\ZA\SPONDY\OUT\entry1.P01';
>
>FILENAME PGM 'E:\ORTHO\PROJECTS\ZA\SPONDY\PGM\entry1.P01';
>I have done this for years using DM commands to save and clear SAS
windows.
>
>I currently have a project that I want to run from a shared drive that
has so
>many levels that it is cumbersome to include all of this information in
the
>LIBNAME AND FILENAME statements. Therefore, I would like to "split up"
this
>information. My initial thought is to create code that indicates the
drive and
>the project and then use this information to inform the usual LIBNAME AND
>FILENAME
>Statements. I'm not quite sure of the syntax or where to even look for
this.
>
>I'm currently running SAS 9.0 under Windows.
>
>My "idea"
>
>FILENAME DRIVE 'W:\'; /* the drive letter
>where the project resides */
>FILENAME PROJECT 'ORTHO\PROJECTS\ZA\SPONDY'; /* the name of the
>project (consistent with the example above */
>
>LIBNAME SAVE 'DRIVE\PROJECT\DAT'; /* location of SAS
>permanent files, based on drive and project names */
>LIBNAME LIBRARY 'DRIVE\PROJECT\FOR'; /* location of SAS
>format library */
>FILENAME LOG 'DRIVE\PROJECT\LOG\ENTRY1.P01'; /* location and name
for
>log file for program entry1.p01 */
>FILENAME OUT 'DRIVE\PROJECT\OUT\ENTRY1.P01'; /* location and name
for
>output file from program entry1.p01 */
>FILENAME PGM 'DRIVE\PROJECT\PGM\ENTRY1.P01'; /* location and name
for
>program file entry1.p01 */
>
>I have tried the above and, obviously since I'm writing this
>note, it didn't work. Hopefully some guru out there can
>enlighten me about how to accomplish this task.
>
>As always, thanks in advance for any help.
Hi, Kevin,
Your "idea" is great and it will work if you use macro variable for drive
and project, and stick to double-quotation marks. I would do something
like the following.
%let pwd = w:\ortho\projects\za\spondy;
%let fn = entry1;
libname save "&project.\dat";
filename log "&project.\log\&fn..log";
filename out "&project.\out\&fn..lst";
...
Cheers,
Chang
|