BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12

What is the SAS proc sql equivalent of the oracle function is null that accepts two parameters the column you are checking and the value to use when null.  I found a reference to ifnull() function but when I tried it I got an error.  Maybe it's a simple syntax thing.

1 ACCEPTED SOLUTION

Accepted Solutions
mklangley
Lapis Lazuli | Level 10

COALESCE() for numeric variables.   (e.g. coalesce(numeric_var, 0) )

COALESCEC() for character variables.   (e.g. coalescec(char_var, 'abc') )

View solution in original post

2 REPLIES 2
mklangley
Lapis Lazuli | Level 10

COALESCE() for numeric variables.   (e.g. coalesce(numeric_var, 0) )

COALESCEC() for character variables.   (e.g. coalescec(char_var, 'abc') )

ballardw
Super User

IFNULL in SAS as far as I know is restricted to FEDSQL use and not for Proc SQL.

 

The Coalesce functions as @mklangley references will return the left most non-missing value of a list of variables or values (3,4,5 or more) so may be more flexible.

Coalescec (var1, var2,var3,'result') would 'result' if all of var1 through 3 were missing (or null for those who haven't quite mastered the SAS jargon yet).

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 9278 views
  • 1 like
  • 3 in conversation