![]() Chapter Contents |
![]() Previous |
![]() Next |
| %LET |
| Type: | Macro statement |
| Restriction: | Allowed in macro definitions or open code |
| See also: | %STR and %NRSTR |
| Syntax | |
| Details | |
| Example | |
| Sample %LET Statements | |
Syntax |
| %LET macro-variable =<value>; |
| Details |
If the macro variable named in the %LET statement already exists, the %LET statement changes the value. A %LET statement can define only one macro variable at a time.
| Example |
These examples illustrate several %LET statement:
%macro title(text,number);
title&number "&text";
%mend;
%let topic= The History of Genetics ; /* Leading and trailing */
/* blanks are removed */
%title(&topic,1)
%let subject=topic; /* &subject resolves */
%let &subject=Genetics Today; /* before assignment */
%title(&topic,2)
%let subject=The Future of Genetics; /* &subject resolves */
%let topic= &subject; /* before assignment */
%title(&topic,3)
When you submit these statements, the TITLE macro generates the following statements:
TITLE1 "The History of Genetics"; TITLE2 "Genetics Today"; TITLE3 "The Future of Genetics";
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.