BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
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
Doc_Duke
Rhodochrosite | Level 12
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.
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3039 views
  • 0 likes
  • 3 in conversation