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.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 1875 views
  • 0 likes
  • 3 in conversation