|
I'd probably do something like this: D Testdate s d C *mdy move birthdate Testdate C if Testdate > %date() .... if in the future, subtract 100 years from the date. C eval Testdate = TestDate - %years(100) C endif C eval dob = TestdateThis is not perfect for reasons others have explained. You may be able to improve the formula by using a date of %date(1998-01-01) if you are sure that every record you have is for people born before January, 1998 (driver license applicants, for example.) That example gives you ages of 7 to 107 years old, which may be enough for your purposes.
Karen L Hodge/MIS/Genesys wrote:
Here is my code: Dmmddyy S d datfmt(*mdy) * Convert dob from mm/dd/yy to ccyymmdd c *mdy move birthdate mmddyy C *iso move mmddyy dob dob is defined as 8 numeric. Anyone with a birth year before 1940 is being set to 2000.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.