Hi all
here am writing d code to check missing day month year from the input below & display the correct format according to the given values below. my input dates are
YYYY-MM-
YYYY
YYYY- - DD
MM-DD
the values to display according to the corresponding input value in the output should be in sas numeric date format since these dates values are missing how to display them as output ?
thanks in advance
There's no such thing as a SAS numeric date format that will handle all of the possible combinations of missing you show.
You probably ought to read in these dates with missing fields as text, and then display them as text.
dirty data in equals results that are unreliable. Send the data back to the compiler or the person who supplied the data and make them correct the issue. Or get with the DB Admin and make that date field mandatory valid date required.
It's all fun and games until someone losses an eye.
You need to first state rules how those missing month and day values need to be replaced (eg should a missing month be set to January, or June, or December?).
Once these rules are known, they can be put into code.
Hi,
SAS stores date values as numeric values, i.e. number of days from 1st Jan 1960 (this is not a format, just numeric values and needs format to be given to represent as dates that we can understand).
YYYY-MM- Here missing day values, so it can be any value between 0-31 (31 dates possibility)
YYYY Here missing month and date (365 dates possible)
YYYY- - DD Here missing month (12 dates possible)
MM-DD Here missing year (infinite dates possible)
Set rules to consider one value out of all the possible values.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.