I've a dataset like below.
A B
1 .
. 2
3 .
. 4
5 .
I need the dataset like below. Basically I need the non-missing values for each observation. May I request someone to guide me to accomplish this task via Proc SQL?
A B C
1 . 1
. 2 2
3 . 3
. 4 4
5 . 5
Like this.
The MAX function ignores null values and SAS missing values. So the missing is completely ignored. Thus: max does not return 5 because 5 > . , the missing is just not considered.
data ab;
input a b;
datalines;
1 .
. 2
3 .
. 4
5 .
;
run;
PROC SQL noprint;
create table abc as
select * , max(a,b) as c
from ab;
QUIT;
/* end of program */
Koen
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.