I need to calculate age for a dataset, but all I have is year of birth and the date they entered the program. I need to calculate the approximate age each sample was when they entered the program based on the year of his/her birth and the date they entered the program. I just am not sure the correct program to do this. I know how to do this with two actual dates, but not from a year and a date. Thank you for any help provided.
With only the Birth year available your options are limited, but for estimation purposes we can make a stab at it.
SAS has "parsing" functions for date/datetime values. My example below uses the YEAR function to extract the year from the date the subject entered the program. Let me know if this is the direction that you want to go.
The SAS language functions YEAR, MONTH, DAY (for DATE component extraction) and to assign a SAS DATE variable consider using MDY function. Check the SAS Language DOC, also using SAS Dates conference/technical papers found on the SAS support website.
Suggested Google advanced search arguments, this topic / post:
What does your data look like ? especial your age and date?
And I think the most important thing is the weight of each month you want to set.
If you want set weight of each month to 1 (i.e. everyone birth at each month has the same probability.
So It base on your prior - probability to each month.