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';
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.