* Create SAS data set of grandparent data; * Read in dates properly; OPTIONS YEARCUTOFF = 1915; * What if this option were left off?; DATA grand; INPUT name $ birthdate MMDDYY8. deathdate :DATE9. married DDMMYY8.; IF deathdate eq '.' THEN DO; age=TODAY() - birthdate; /* This gives the age in days */ age=age/365.25; /* Now this converts the age to years */ END; ELSE age=.; age_if_alive = (TODAY() - birthdate)/365.25; date_turned_one = birthdate + 365; CARDS; James 02/10/19 25Aug04 28/12/43 Mary 01/15/23 23Jun03 28/12/43 Donald 09/04/18 . 12/05/45 Karen 08/28/18 . 12/05/45 ; RUN; PROC PRINT DATA = grand; FORMAT birthdate DATE9. deathdate MMDDYY10. married WEEKDATE17. date_turned_one WORDDATE12.; title 'Grandparents Age'; RUN;