Desktop productivity for business analysts and programmers

how do i convert date of birth to age in enterprise guide?

Reply
N/A
Posts: 0

how do i convert date of birth to age in enterprise guide?

i am new to enterprise guide 4 . I have a column for date of birth e.g. 09251962. I would like to calculate current age.

Thanks Message was edited by: rj
SAS Super FREQ
Posts: 8,820

Re: how do i convert date of birth to age in enterprise guide?

Hi:
First, you need to know what form your date column is -- is it a character value, is it a SAS date value or is it a date/time value???

Next, you have to decide what constitutes current age? Is it the age as of today? as of Jan 1, 2007, as of the beginning of the month?

And, do you want the age to be in "whole" years (35) or would you want to see "fractions" of a year (35.62) .

There are several ways to generate the current age -- the arithmetic way and the function way. If you want to use the current day or today's date to calculate age, then there is a SAS function that turns today's date into a SAS date value. That function is the TODAY function. Then the YRDIF function will give you the number of years between two dates (and the DATDIF function will give you the number of days between two dates).

The other piece of information that will affect the answer is how and where in EG you need to get the age. Do you need it in a table? Do you need it on a report -- and not saved permanently?

Your best bet for help might be to contact Tech Support for specific help with EG and calculating age, depending on the answers to all the above questions. To find out how to contact Tech Support, refer to:
http://support.sas.com/techsup/contact/index.html

cynthia
Trusted Advisor
Posts: 2,114

Re: how do i convert date of birth to age in enterprise guide?

This sample shows how to compute age in years.

http://support.sas.com/ctx/samples/index.jsp?sid=271

It computes it as someone might say his or her age in the USA. The yrdif provides a decimal number, with a fractional part.

Both methods have their place, it depends on your needs.
N/A
Posts: 0

Re: how do i convert date of birth to age in enterprise guide?

I am actually tryign to use Enterprise Guide 4 to do this. I am a new user of SAS Enterprise Guide 4. I have a column of birth dates and would like to know the ages of people this year.

I know i have to use the Filter adn Query tool. I do not know how to proceed from there.

Thanks and really appreciate the help

Rumana
SAS Super FREQ
Posts: 8,820

Re: how do i convert date of birth to age in enterprise guide?

Your best bet for help might be to contact Tech Support for specific help with EG and how to do this in Filter and Query. EG is a visual interface to SAS. It is building code behind the scenes. Many people on the Forum can send you the code to calculate age. If you need help doing it in a point and click manner in EG, then consulting an EG book, taking an EG class or contacting Tech Support, will be of the most help to you:
http://support.sas.com/techsup/contact/index.html

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 1195 views
  • 0 likes
  • 3 in conversation