BookmarkSubscribeRSS Feed
otepalborida
Obsidian | Level 7

Hi SAS Community,

 

Good day!

 

I am seeking for a help to anyone who knows how I can solve my scenario.

 

So i have these tables of CI_CONTACT_HISTORY containing all the records of client who are contacted (SMS, TLS, PUSH, EMAIL)

 

What i am currently doing is, i created a calculated item (FLAG_CALL) to get some clients using their data in CONTACT_HISTORY. Below is the expression on my created calculated item.

 

CASE
WHEN DATEPART(<</Contact History/CONTACTED_DTTM>>) ^= DATE() - 4 & <</Contact History/CONTACT_HISTORY_STATUS_CD>> = '_40' & <</Contact History/CAMPAIGN_NM>> = 'CAMP984' & <</Contact History/CHANNEL_CD>> = 'SMS'
THEN 'N'
ELSE 'Y'
END

 

In translation, I want to get all those clients that are not contacted (by SMS) 4 days ago when the campaign (TLS) is executed. If it is not contacted, I'll tagged his FLAG_CALL attribute into "N", meaning the client is not yet eligible for calling since he/she did not receive any SMS D - 4, else it will be tagged as "Y", meaning the client was received an SMS D - 4 and now eligible for calling.

 

Apparently, while using this expression, it seems that there is something wrong because all the clients are all tagged with "Y" which is not expected.

 

Hope someone can help.

 

If the details are not yet okay, I'll explain it further.

 

Thank you.

 

Regards,

Otep

1 REPLY 1
mkeintz
PROC Star

If you are producing  no "N" results, then SAS is telling you that you have no cases in which all 4 conditions are simultaneously true. Or to be more accurate, there are no such cases that also satisfy any other filters you may have in the rest of your PROC SQL.  There is nothing else that can be deduced from the code fragment you have provided.

 

Provide the complete SQL code, and the resulting log notes and messages to give us a better idea of whether it is a coding problem, or merely the data revealing the authentic absence of "N" cases.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 298 views
  • 0 likes
  • 2 in conversation