01-20-2017 12:01 AM
I have a dataset where if the month is missing in the date, I need to set it to 1 and if the day is missing i need to set it to 15. I am not sure how to approach it. I know how to check for the missing month or day but how do I set it to 1 or 15?
01-20-2017 02:03 AM
You haven't given us enough information to help. Please post some example data of what you have and what you need.
A SAS date is the number of days from Jan 1, 1960, but since you're missing components you likely have a text string. What that looks like is anyone's guess.
SUBSTR can be used to replace text
The best solution is to create a SAS date so extract the parameters you do have and then use the replacement values in the ones you don't.
MDY() will create a date.