BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
stevo642
Obsidian | Level 7

The first of two one-line IML programs below returns an "Unresolved label:" error message.

 

The second does not (but it's useless code since the label appears immediately after its invocation).

 

Any tips on getting the first program to work are appreciated.

 

proc iml; if (1<2) then goto THEEND; temp = 1; THEEND: temp=1; quit; run;


proc iml; if (1<2) then goto theEnd; theEnd: temp=1; quit; run;

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

As hinted by unison, the IML documentation says:

 

Note: The GOTO and LINK statements must be inside a module or DO group. These statements must be able to resolve the referenced label within the current unit of statements. Although matrix symbols can be shared across modules, statement labels cannot. Therefore, all GOTO statement labels and LINK statement labels must be local to the DO group or module.

 

proc iml;
x = 1;
ITER:
if x<5 then do;
   x = x + 1;
   goto ITER;
end;
print x;

View solution in original post

4 REPLIES 4
unison
Lapis Lazuli | Level 10

Have you tried wrapping your statements in a do; end;?

for example:

... then do;
*code;
end;
*other code;
run;

-unison 

-unison
Rick_SAS
SAS Super FREQ

As hinted by unison, the IML documentation says:

 

Note: The GOTO and LINK statements must be inside a module or DO group. These statements must be able to resolve the referenced label within the current unit of statements. Although matrix symbols can be shared across modules, statement labels cannot. Therefore, all GOTO statement labels and LINK statement labels must be local to the DO group or module.

 

proc iml;
x = 1;
ITER:
if x<5 then do;
   x = x + 1;
   goto ITER;
end;
print x;
stevo642
Obsidian | Level 7

so simple, thank you, Rick!

stevo642
Obsidian | Level 7

When I submit the code below, I get "ERROR: Unresolved label: THEEND" for the 1st one-line IML program but not the second. The second is useless because the label immediately follows its invocation. Any tips on getting the 1st one to work?

 

** this 1-line program gets an "Unresolved label:" error message;
proc iml; if (1<2) then goto theEnd; temp = 1; theEnd: temp=1; quit; run;


** this useless 1-line program does not get an error message;
proc iml; if (1<2) then goto theEnd; theEnd: temp=1; quit; run;

 

Thanks, Steve

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 1544 views
  • 1 like
  • 3 in conversation