The following IF/THEN-ELSE statements execute a different PUT _ODS_ statement based on the specified conditions:
If BUSINESS_PHONE contains missing values, then the PUT statement writes values for LAST_NAME, FIRST_NAME, and BUSINESS_PHONE (the columns that are defined in the ODS= option) into the output buffer. The PUT statement then writes the value for HOME_PHONE in column 3, overwriting the missing value of BUSINESS_PHONE.
If HOME_PHONE contains a missing value, then the PUT statement simply writes values for LAST_NAME, FIRST_NAME, and BUSINESS_PHONE to the buffer.
Finally, if both phone numbers have values, then the PUT statement writes values for LAST_NAME, FIRST_NAME, and BUSINESS_PHONE to the buffer in the first line. SAS then goes to the next line (as directed by the line pointer control / ) and writes the value of HOME_PHONE in the third column of the next line.
if (missing(business_phone)) then put _ods_ @3 home_phone; else if (missing(home_phone)) then put _ods_; else put _ods_ / @3 home_phone; run;