|
我直接把书贴上来吧,看来你需要看看
Compiling an Externally Stored Macro Definition with the %INCLUDE Statement
%include 'c:\sasfiles\prtlast.sas' / source2;
proc sort data=sasuser.courses out=bydays;
by days;
run;
%prtlast
Listing the Contents of a Catalog
proc catalog cat=work.sasmacr;
contents;
title "Default Storage of SAS Macros";
quit;
Using the Catalog Access Method
filename prtlast catalog 'sasuser.mymacs.prtlast.source';
%include prtlast;
proc sort data=sasuser.courses out=bydays;
by days;
run;
%prtlast
Accessing an Autocall Macro
options mautosource sasautos=('c:\mysasfiles',sasautos);
%prtlast
Creating a Stored Compiled Macro
libname macrolib 'c:\storedlib';
options mstored sasmstore=macrolib;
%macro words(text,root=w,delim=%str( ))/store;
%local i word;
%let i=1;
%let word=%scan(&text,&i,&delim);
%do %while (&word ne );
%global &root&i;
%let &root&i=&word;
%let i=%eval(&i+1);
%let word=%scan(&text,&i,&delim);
440 Chapter 12 • Storing Macro Programs
%end;
%global &root.num;
%let &root.num=%eval(&i-1);
%mend words;
Points to Remember
•You can make macros available to your programs in four ways: as session-compiled macros, with a %INCLUDE statement, through the autocall facility, or as stored compiled macros.
•If you use the autocall facility, you must specify the MAUTOSOURCE and SASAUTOS= system options.
•If you use the stored compiled macro facility, you must specify the MSTORED and SASMSTORE= system options.
•The point at which macro compilation occurs depends on which method you use to access the macro.
|