I did numerous google seraches but could not find an answer. What is the syntax, if I have several statements in the if and the then part of an if the statement? This is some pseudo code:
if /* some condition */ then do; /* statements */ end; else do /* statements */ end;
The if part is fine but I am not sure about the then part.
You're missing a semicolon after the second DO statement.
See the examples in the documentation 🙂
Google seems broken these days. Consider searching directly at either lexjansen.com, communities.sas.com or support.sas.com
This one has a fourth example that is interesting, I wouldn't have expected that to work.
if x=0 then
if y ne 0 then put 'X ZERO, Y NONZERO';
else put 'X ZERO, Y ZERO';
else put 'X NONZERO';
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.