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;
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;
Have you tried wrapping your statements in a do; end;?
for example:
... then do;
*code;
end;
*other code;
run;
-unison
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;
so simple, thank you, Rick!
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
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!
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.