I just came across code that looks like this:
data test;
input x1;
select (x1);
when (1) do
x2 = 1;
x3 = 1;
end;
otherwise;
end;
datalines;
1
0
;
and I immediately thought "ERROR because of missing semicolon!", but this code works, and it even works as obviously intended.
Does anybody know why SAS does not complain here?
Yes, it's the iterative DO statement (with x2 as the index variable), just written in a "peculiar" way, not a DO-END block.
Yes, it's the iterative DO statement (with x2 as the index variable), just written in a "peculiar" way, not a DO-END block.
Oh yes, that's it! It works, but it nicely fits a schlockmercenary quote I posted yesterday:
"When it's stupid and it works, it's still stupid, and you're lucky"
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.