General form, %LET statement:
%LET variable=value;
variable
is any name that follows
the SAS naming convention.
value
can be any string from
0 to 65,534 characters.
variable or value
if either contains
a reference to another macro variable (such as
&macvar ),
the reference is evaluated before the assignment is made.
|
time
and assign a value of afternoon
to
it, you would submit the following %LET statement: %let time=afternoon;
%LET Statement
|
Variable Name
|
Variable Value
|
Length
|
---|---|---|---|
%let name= Ed Norton ; |
name |
Ed
Norton
|
9
|
%let name2=' Ed Norton '; |
name2 |
'
Ed Norton '
|
13
|
%let title="Joan's Report"; |
title |
"Joan's
Report"
|
15
|
%let start=; |
start |
|
0
|
%let total=0; |
total |
0
|
1
|
%let sum=4+3; |
sum |
4+3
|
3
|
%let total=&total+&sum |
total |
0+4+3
|
5
|
%let x=varlist; |
x |
varlist
|
7
|
%let &x=name age height; |
varlist |
name
age height
|
15
|
site
.
The macro variable site
is then used
to control program output. %let site=DALLAS; title "REVENUES FOR &site TRAINING CENTER"; proc tabulate data=sasuser.all(keep=location course_title fee); where upcase(location)="&site"; class course_title; var fee; table course_title=' ' all='TOTALS', fee=' '*(n*f=3. sum*f=dollar10.) / rts=30 box='COURSE'; run;