There are situations where prior to running a SAS Editor(s) one may be required to run a list of files (SAS or non SAS). Our objective is how to call them in a single statement.
We need to run a set of SAS files prior to a SAS code. The usual scenario is to execute them one by one. But it is possible to access a set of files or members from this storage location by a single statement as follows.
Using filename statement we assign the fileref storage in an aggregate location.
filename storage “An- Aggregate –storage- location”;
Several files or members from this storage location can be accessed by listing them in parentheses after the fileref in a single %INCLUDE statement
%inc storage (Monthly, Quarterly); Non SAS files can also be accessed using quotation marks around the complete filename listed inside the parentheses. %inc storage ("file-1.txt","file-2.dat","file-3.cat"); Auto call SAS macros and Formats When the SAS editors contain user defined macros the above %inc statement does not work. In this situation we use sasautos option. Usually the formats and macros will be in separate folders. In those situations they can be called as follows. Libname project “project-path”;Libname formlib “format –path”;Libname mymacros “macro-path”; options fmtsearch=(formlib project) sasautos=( mymacros) mautosource ;
The fmtsearch option searches the formats in the files or libraries in the following order
1. Work.formats
2. formlib.formats
3. project.formats
Sasautos option invokes the macros in the file reference storage.
The auto call facility is usually used when all user-defined macros are stored in a standard location and they are not compiled until they are actually needed.
But when we get formats and macros in the same folder it is better to use the following statement.Options fmtsearch=( storage project) sasautos=( storage ) mautosource ; Here even though library work is not specified the fmtsearch option will search for the formats in the work library by default as mentioned earlier.The formats can also be called without using fmtsearch option if we know the name of SAS file which contains all the formats for the particular study. We can access the formats using a single %include statement.
%inc storage (formats);
Here the SAS editor formats contain all the formats for the study.
No comments:
Post a Comment