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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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