Hi, Bruce -

Thanks for your time and response. I spent an inordinate amount of time and
effort to create a working formula, and thought there must be an easier
way. I had in mind a function similar to DATEDIF in Excel.

Glad to have the opinion of someone more versed in R:Base than I am. I will
use it - as is - in all its ugliness, since it works.

Cheers,


On Fri, Nov 10, 2023 at 10:24 PM Bruce Chitiea <rby...@safesectors.com>
wrote:

> Charles: Played with it a bit, searching for elegance. The only fully
> duplicated segment 'DOD - DOB' is wrapped on all sides by unique function
> strings, so atomization likely creates more work than it's worth. So, ugly
> it may be; but if it works ...
>
> Alternately, from the list in 2016:
>
> CLEAR VAR v%
> CLS
>
> SET VAR vBegDATE DATE = NULL
> SET VAR vEndDATE DATE = NULL
> SET VAR vBegTIME TIME = NULL
> SET VAR vEndTIME TIME = NULL
>
> SET VAR vBegDATE = (RDATE(4,21,2016))
> SET VAR vEndDATE = (RDATE(4,27,2016))
> SET VAR vBegTIME = (RTIME(10,20,0))
> SET VAR vEndTIME = (RTIME(14,15,0))
>
> SET VAR vBegDATETIME = (DATETIME(.vBegDATE, .vBegTIME ))
> SET VAR vEndDATETIME = (DATETIME(.vEndDATE, .vEndTIME ))
>
> SET VAR vElapsed_MIN = ((.vEndDATETIME - .vBegDATETIME)/60)
> SET VAR vElapsed_HR  = (ROUND((.vElapsed_MIN/60),3))
> SET VAR vElapsed_DAY = (ROUND((.vElapsed_HR/24),3))
>
> SHOW VARIABLES V%
>
> RETURN
>
> Maybe there's some gold there.
>
> Best, Bruce
>
> Bruce A. Chitiea
> SafeSectors, Inc.
> 1142 S Diamond Bar Blvd # 442
> Diamond Bar CA 91765-2203
>
> rby...@safesectors.com
> (909) 238-9012 m
>
> ------ Original Message ------
> From "Charles Stevens" <stevens...@gmail.com>
> To rbase-l@googlegroups.com
> Date 11/10/2023 1:36:33 PM
> Subject [RBASE-L] - Calculating Age in Years, Months
>
> Hello All -
>
> I am wondering if there is a more elegant way to find the difference
> between two days expressed as Years, Months, than what I have been using,
> below, which produces the results nny nnM, but seems clumsy:
>
>
> *(CTXT(INT((DOD - DOB)/365.25))+'Y')&(CTXT(INT(MOD(DOD -
> DOB,365.25)/30.44))+'M')  *
>
> Where 'DOD'=Date of Death, 'DOB'=Date of Birth, 365.25=number of days in a
> year, and 30.44=number of days in a month.
>
> Seems to me this should be a commonly needed calculation.
>
>
>
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rbase-l+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rbase-l/CADAyCN_2mA%3DZmh3jgYnEaRDZ3JWgudXfBNTdP_Km704YLuKGEA%40mail.gmail.com
> <https://groups.google.com/d/msgid/rbase-l/CADAyCN_2mA%3DZmh3jgYnEaRDZ3JWgudXfBNTdP_Km704YLuKGEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rbase-l+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rbase-l/emb1486432-408d-4603-94dc-fdd6aa373662%40ffc94789.com
> <https://groups.google.com/d/msgid/rbase-l/emb1486432-408d-4603-94dc-fdd6aa373662%40ffc94789.com?utm_medium=email&utm_source=footer>
> .
>

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rbase-l+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/CADAyCN-eDQc%2B20aCaacxJth%3D3B-7aajOAO4kt9qy-3MfTqO9tA%40mail.gmail.com.

Reply via email to