BookmarkSubscribeRSS Feed
a13
Calcite | Level 5 a13
Calcite | Level 5

code:

%LET iterations = 5;
%LET winner = Lance Armstrong;
DO i = 1 to &iterations;
TITLE "First: &winner";

 

log:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 %LET iterations = 5;
74 %LET winner = Lance Armstrong;
75 DO i = 1 to &iterations;
__
180
 
ERROR 180-322: Statement is not valid or it is used out of proper order.
 
76 TITLE "First:" &winner;
WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.
77
78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
2 REPLIES 2
novinosrin
Tourmaline | Level 20

macro loops need macro syntax

 

%LET iterations = 5;
%LET winner = Lance Armstrong;
DO i = 1 to &iterations;
TITLE "First: &winner";

 

something like: 

 

 %macro a13;

%DO i = 1 %to &iterations;
TITLE "First: &winner";

%end;

%mend a13;

 

Your code doesn't ring the bell in what you want to accomplish 

ballardw
Super User

%LET iterations = 5;
%LET winner = Lance Armstrong;
DO i = 1 to &iterations; <- This DO belongs in a data step block of code. You may be thinking of a macro loop which would use %DO but still has a syntax error because you show no End or %end.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1058 views
  • 0 likes
  • 3 in conversation