philihp.com

Tag: Dates

How to get the Last Day of a Month in SAS

SAS has a really neat function called intnx, which will increment a date to the next of an interval. For example, if you have a date (any date. maybe the current date?), you can get the date of the first day of the next month by doing this: data _null_; d = ’11JUN2011′d; format d [...]

Converting between Date and Datetime in SAS

In SAS, fields are either character of varying length, or numeric. No exceptions. Temporal values such as Date and Date/Time are stored as either the number of days or seconds since 1960 January 1st. In order to convert from Date/Time to Date, and from Date to Date/Time, you could divide or multiply respectively by 86400 [...]