Hello team,
Proc SQL; select b.this, a.this, case When b.rate <0.25 Then (somenum/b.rate)
b.rate is equal 0, then we have divide by zero. This produces errors in Excel and is handled by IfError.
What is the equal of IFError is in SAS?
respectfully,
Blue blue
case when b.rate>0 and b.rate <0.25 then (somenum/b.rate)
This will not produce an error in SAS, but the resulting variable is still missing in SAS.
You can also do this:
case when b.rate <0.25 then divide(somenum,b.rate)
which also gives a missing, but no error.
The following will replicate the same behavior as IFERROR.
Proc SQL; select b.this, a.this, case When b.rate <0.25 Then coalesce(somenum/b.rate.0)
For more information please see:
Function documentation:
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/p1gdr5t7sd3g3qn1d7fg23zuwzml.htm#!
An example:
https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473712.htm
Best,
K
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.