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

As part of a large data set, 2 of my columns contain dates that basically represent the same thing, and they both have missing data in different rows.

 

For example:

Column A      Column B     Date_Start   Date_Begin    Column E

                                              1/1/15          1/1/15

                                              1/4/15

                                                                  1/6/15

                                              1/7/15

                                              1/9/15          1/9/15

 

How do I combine the Date_Start and Date_Begin columns to replace the blank cells so that I get something like this:

 

Date_Combine

       1/1/15

       1/4/15

       1/6/15

       1/7/15

       1/9/15

 

I've also tried Proc Sql, Proc Format, and simply copying Date_Begin across to Data_Start (seen at the end) but it doesn't seem to be working i.e. If Missing(Date_Start) then Date_Start = Date_Begin

 

Any help with the coding would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
kiranv_
Rhodochrosite | Level 12

coalesce function will do it.

 

proc sql;

select coalesce(Date_Start ,  Date_Begin) as Date_Combine

from yourtable;

quit;

View solution in original post

1 REPLY 1
kiranv_
Rhodochrosite | Level 12

coalesce function will do it.

 

proc sql;

select coalesce(Date_Start ,  Date_Begin) as Date_Combine

from yourtable;

quit;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 7472 views
  • 2 likes
  • 2 in conversation