Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • fraction data

    dear all
    i have some date related problems
    where i have to calculate age from death date to birth date
    for example death date 22/04/1928 birth date 21/02/2015
    for this i used "gen age ==(dthdate-bdate)"

    this command calculate age in dayes like 31747

    than i had used this command "gen age1=(age/365)"

    it calculate age in years 86.97808

    now i want to transfer this fraction age in to a complete number like
    86.97808=87

    the condition i want to use is if the number after fraction >.50 i want the next number like 1.52=2
    and if the umber after fraction<.50 i want the previous number like1.49=1
    How can i solve this?
    Regards
    Raeed







  • #2
    Raeedur:
    you may want to try:
    Code:
    replace age1=round(age1)
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      thanks Carlo

      Comment


      • #4
        See also personage (SSC)

        Comment

        Working...
        X