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

I need to return an existing date from a column or for it to assign a specific date "12-31-2016" but I am getting the following error:

 

4 PROC SQL NOEXEC;
5 SELECT (ifn(t1.consolidated is not missing, t1.consolidated, "12-31-2016")) AS CALCULATION
6 FROM WORK.QUERY_FOR_MERGEDFINALANDANCHORDA t1;
ERROR: Function IFN requires a numeric expression as argument 3.

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

See the documentation for SAS constants: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=lrcon&docsetTarget=p0cq7f...

 

A SAS date constant (or literal in SAS parlance) needs to be written in the form

"DDMMMYYYY"d

where DD is the day of the month, MMM the month spelled out with three characters, and YYYY the year.

Your date would therefore be

"31DEC2016"d

The month can be lowercase as well.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

See the documentation for SAS constants: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=lrcon&docsetTarget=p0cq7f...

 

A SAS date constant (or literal in SAS parlance) needs to be written in the form

"DDMMMYYYY"d

where DD is the day of the month, MMM the month spelled out with three characters, and YYYY the year.

Your date would therefore be

"31DEC2016"d

The month can be lowercase as well.

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!

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