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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 7 replies
  • 989 views
  • 1 like
  • 4 in conversation