Need assistance finding DOB with a start date and age. Also has to include a do loop.
Age is 40.
Start date is February 15, 2001.
My script so far:
data birth;
Age = 40;
Start = '15Feb2001'd;
Bday=Start-Age;
do Age = 1 to 90 until (Start lt '15Feb2001'd);
output;
end;
run;
proc print data=birth;
format Start Bday mmddyy10.;
run;
You can tell the year and the month, sort of, but you cannot determine the exact date.
And the solution still doesn't need arrays or loops so, in context of how you originally framed the question, it still doesn't add clarification.
If you want the answer to this question, use INTNX to move the date back by the age.
You can look at the fourth parameter for some alignment options, but really the birthdate can be anything in the range of a year.
dob = intnx('year', date, -40, 'b');
@asobs wrote:
Need assistance finding DOB with a start date and age. Also has to include a do loop.
Age is 40.
Start date is February 15, 2001.
My script so far:
data birth;
Age = 40;
Start = '15Feb2001'd;
Bday=Start-Age;
do Age = 1 to 90 until (Start lt '15Feb2001'd);
output;
end;
run;
proc print data=birth;
format Start Bday mmddyy10.;
run;
DOB doesn't change over time...why do you think you need a do loop for that?
T
Well...the question as posed doesn't make sense so I'm not sure how we can help you here.
You can tell the year and the month, sort of, but you cannot determine the exact date.
And the solution still doesn't need arrays or loops so, in context of how you originally framed the question, it still doesn't add clarification.
If you want the answer to this question, use INTNX to move the date back by the age.
You can look at the fourth parameter for some alignment options, but really the birthdate can be anything in the range of a year.
dob = intnx('year', date, -40, 'b');
Thank you for reminding me why I should never bother with stupid and homework questions.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.