user12204360
user12204360

Reputation:

How can I know the date of birth given the age (in decimals) and the date (of that age) in SAS?

Create a new variable called “dob” which reflects a person’s date of birth. the value of age represents exactly how old an individual is (in years) on the date given (i.e. Janet White is 44.2 years old on May 11th, 2018) This is my dataset:

DATA mydata1;
input name $15. age date MMDDYY8.;
format date MMDDYY8.;
datalines;
Janet White     44.2 5/11/18  
Bob Greene      32.1 6/14/18
Lou St. Pierren 29.9 4/28/18
;
run;

Upvotes: 0

Views: 123

Answers (1)

jarg
jarg

Reputation: 36

Tom's right in that the DOB can only be estimated here, and Craig's right in that the intnx function is the way to go (and also that we shouldn't do your homework..) but your answer should look something like:

data mydata2;
set mydata1;
format  DOB date9.;
        DOB = intnx('years',date,-age,'same');
run;

Upvotes: 1

Related Questions