Hello, I have a simple question regarding determining a customers age based on their birth date. In my records the birthdate is included in the ddmmmyyyy format. I would like to determine their age as a new variable in the table. Do I have to reformat it and check it against SAS's internal calender to determine this? How would I go about doing this? thanks for any help anyone can provide.
The answer is: "it depends". If you birthdate variable is a character-type, you will need to convert it to a SAS numeric DATE variable using the INPUT function and the appropriate SAS DATE INFORMAT. However, if a SAS PROC CONTENTS on your SAS database file indicates that this variable is SAS NUMERIC and is using some SAS format to display (externally) the formatted value, then you can use SAS functions, such as INTCK, to determine age.
Have a look at the SAS support website http://support.sas.com/ and the SAS Base documentation in the SAS Language guide. Also, at the support site (using the SEARCH option), there are technical papers (SUGI, SGF - user group conference proceedings) which explore this topic in great detail.
INTCK will not produce age as you and I think of it, as it only counts whole calendar years and not duration between the birthday and some date. Once you have your dates into date format, use this technique