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';
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.