We help IT Professionals succeed at work.

Is there a way to check a date field in SAS for a missing date

morinia
morinia asked
on
I have two date fields in SAS   DATEA and DATEB.  Both fields may be empty of both fields may have a date.

Is there a way to check of DATEA is missing and DATEB is not missing to Set FIELDC = 'Y'?

I am having a problem checking a date field for a missing value.
Comment
Watch Question

CERTIFIED EXPERT

Commented:
Your condition should look like:
DATEA = . And DATEB <> .

What's the error you are getting? What does your code look like now?
moriniaAdvanced Analytics Analyst

Author

Commented:
I am sorry, I formatted the dates so when I did a proc contents they are defined as:

         Char   len 10

I formatted the dates as MMDDYY10.
CERTIFIED EXPERT
Commented:
could the field have anything other than a date, for example an invalid date value? or do you simply want to check for missing value?

if so, simply do DATEA = '' and DATEB <> '' should work
moriniaAdvanced Analytics Analyst

Author

Commented:
My problem does not seem to be with the missing data.  It is when I have a date in the field
i.e. 12/10/2011 that I am getting an error message

'12'/10/2011'   Invalid numeric data
CERTIFIED EXPERT

Commented:
could you please post your code and log?