Creating a SAS Date When the Day of the Month Is Missing

Some of your date values may be missing the day of the month, but you would still like to create a SAS date by using either the 1st or the 15th of the month as the day. There are two possibilities here. One method is to use the MONYY informat that reads dates in the form of a three-character month name and a two- or four-digit year. If your dates are in this form, SAS will create a SAS date using the first of the month as the day value. The other method of creating a SAS date from only month and year values is to use the MDY function, substituting a value such as 15, for the day argument. An example is shown in Program 4-9.

Program 4-9. Creating a SAS Date When the Day of the Month Is ...

Get Cody’s Data Cleaning Techniques Using SAS® Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.