Printit
would
be stored in a SOURCE entry that is also named Printit
.
Printit
macro
definition to the Sasuser.Mymacs catalog, perform these steps:
General form, CATALOG
procedure with CONTENTS statement:
PROC CATALOG CATALOG=libref.catalog;
CONTENTS;
QUIT;
libref.catalog
is a valid two-level
catalog name.
|
proc catalog cat=work.sasmacr; contents; title "Default Storage of SAS Macros"; quit;
General form, CATALOG
access method to reference a single SOURCE entry:
FILENAME fileref
CATALOG 'libref.catalog.entry-name.entry-type';
%INCLUDE fileref;
fileref
is a valid fileref.
libref.catalog.entry-name.entry-type
is a four-level SAS
catalog entry name.
entry-type
is SOURCE.
|
%macro prtlast; %if &syslast ne _NULL_ %then %do; proc print data=&syslast(obs=5); title "Listing of &syslast data set"; run; %end %else %put No data set has been created yet.; %mend;
Prtlast
.
Then you can reference the macro later in the program. filename prtlast catalog 'sasuser.mymacs.prtlast.source'; %include prtlast; proc sort data=sasuser.courses out=bydays; by days; run; %prtlast
General form, CATALOG
access method to reference multiple SOURCE entries:
FILENAME fileref CATALOG 'libref.catalog';
%INCLUDE fileref(entry-1);
%INCLUDE fileref(entry-2);
fileref
is a valid fileref.
libref.catalog
is a two-level catalog
name.
entry-1 and entry-2
are names of SOURCE
entries in library.catalog.
|
Prtlast
and Sortlast
,
that are stored in a SAS catalog.
%macro prtlast; %if &syslast ne _NULL_ %then %do; proc print data=&syslast(obs=5); title "Listing of &syslast data set"; run; %end; %else %put No data set has been created yet.; %mend;
%macro sortlast(sortby); %if &syslast ne _NULL_ %then %do; proc sort data=&syslast out=sorted; by &sortby; run; %end; %else %put No data set has been created yet.; %mend;
filename prtsort catalog 'sasuser.mymacs'; %include prtsort(prtlast) / source2; %include prtsort(sortlast) / source2; data current(keep=student_name course_title begin_date location); set sasuser.all; if year(begin_date)=2001; diff=year(today())-year(begin_date); begin_date=begin_date+(365*diff); run; %sortlast(begin_date) %prtlast