BookmarkSubscribeRSS Feed
teddyee
Fluorite | Level 6

 

Table 1
CustID, date contact, filter
101, 1-Jan-17, Y
102, 2-Jan-17, N
103, 3-Jan-17, A
104, 4-Jan-17, A



Table 2
CustID, date contact, filter
101, 2-Jan-17, N
102, 2-Jan-17, Y
103, 
104, 4-Jan-17, N


Result
CustID ,date contact ,filter
101, 2-Jan-17, Y
102, 2-Jan-17, Y
103, 3-Jan-17, A
104, 4-Jan-17, N

 

CASE 
WHEN coalesce (1.date_contact,2.date_contact) is not null then max (1.date_contact,2.date_contact)
END AS date_contact FORMAT DATE9.

CASE 
WHEN coalesce (1.filter,2.filter) is not null then max (1.filter,2.filter)
END AS filter

 

Question: i can get the latest date for date_contact when comparing table 1 and 2 but why not for filter??

my result for filter is y>n>a>null

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

1-Why the duplication? See https://communities.sas.com/t5/forums/editpage/board-id/general_program/message-id/47215

2-No need for coalesce() as SAS will ignore missing values (there are no null values in SAS)

teddyee
Fluorite | Level 6

Hi ChrisNZ, unable to open the link, able to send again. thanks

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 4304 views
  • 0 likes
  • 2 in conversation