I would like to concatenate two columns of the same dataset:
ID Date1 Date2 001 1-1999 002 2-2021 003 3-2021 004 03-2019 .... ....... ......
I tried:
data out1 set out Test = coalesce(Date1 Date2); run;
but without success.
Any suggestion?
Thank you in advance
>Solution :
My 2 suggestions:
- Make sure that you use the correct function. Coalesce for numeric values, coalesceC for character
- You are missing a comma between Date1 and Date2.
Do this
data have;
input ID $ (Date1 Date2)($);
infile datalines dlm = '|' missover;
datalines;
001|1-1999 |
002| |2-2021
003| |3-2021
004|03-2019|
;
data want;
set have;
test = coalescec(Date1, Date2);
run;