SAS Slides 12: Macros
SAS Slides 12: Macros
info@sastechies.com
http://www.sastechies.com
Creating
◦ SAS Tables,
◦ Listings,
◦ Basic Statistics Procedures with SAS
◦ Graphs TLG’s
◦ and ODS HTML
◦ Proc Report
Data sharad.sasd
Data &name.sasd - Left – right Forward Scanning
sharadsasd rule
Where sharad is a libname && - &
Data &name..sasd -
sharad.sasd
%SCAN
%scan(&c,1,*);
%SYSFUNC
%sysfunc(today(),weekdate.)
%INDEX
%LENGTH
proc sql;
Global Symbol Table create view subcrsid as
TEACH1 Hallis, Dr. George select
TEACH2 Wickam, Dr. Alice student_name,student_company,p
TEACH3 Forest, Mr. Peter
aid
CRS 3
From sasuser.all
where course_code=symget('crsid');
quit;
teacher=symget('teach'||left(course_number));
No
Yes
No
No
Yes
No
%putloop
You can call a macro within a macro definition. That is, you can nest
macros.
You cannot nest functions within %SYSFUNC, but you can use a
%SYSFUNC for each function that you need, as shown in this
eg: title "Report Produced on %sysfunc(left(%sysfunc
put(today(),worddate.)))";