Could someone tell me an equivalent SAS function for the EXCEL function iferror(), which I could use in a PROC SQL variable assignment. For example, in an datastep if I have a SAS variable defined as: AGE = YRDIF( birthdate, today(), 'ACTUAL'); but for some reason in my data the birthdate is missing, then I get an error. This does not stop SAS, but I would like it to put, for example, 22 (the average age) if the birthdate is missing. In a datastep I would write: if missing(birthdate) then AGE = YRDIF( birthdate, today(), 'ACTUAL'); else AGE = 22; However, in a PROC SQL, how would I do this? All I can think of is if there were an equivalent SAS function like the EXCEL iferror() function, then I could do this in one line. In other words, I would like to write the "equivalent" of (using the EXCEL function): AGE = iferror( YRDIF( birthdate, today(), 'ACTUAL'), 22); If the first argument is null or error, then the second argument is returned for AGE. Thanks in advance. Ian.
... View more