BookmarkSubscribeRSS Feed
Argonious
Calcite | Level 5

Hi,

 

I have this format of a birth date : 06FEB81:00:00:00 and from this I have to calculate the age of the person. How I have to format this in order to be able to use it and then what? Thanks in advance!

7 REPLIES 7
Argonious
Calcite | Level 5

Datetime. the informat is ANYDTDTM40.

Argonious
Calcite | Level 5

I have my answer! Thank you very much! I tried to use this function earlier, but was doing it wrong. Now it works fine. Thanks again!

ballardw
Super User

Note that what you see is a pet peeve of mine, which seems to come from some defaults and/or lazy programming in some applications: storing DATE values as DATETIME. If your data, or your use, has not actual need of the time component you can reduce the variable to only date values using: Date = datepart(datetimevariable); (you could use the same variable as the result) and assign appropriate format for display.

Otherwise in the INTCK and INTNX functions when using a period like 'year' or 'month' you preface the period with 'dt' to tell SAS the value is a date time, hence the 'dtyear'

mkeintz
PROC Star

Pet Peeve yes.  But ...

 

Elvis has left the building

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1447 views
  • 1 like
  • 4 in conversation