SlideServe
Menu
Préférences
© SlideServe · v2026

Tips and Tricks

tillie avatar
9 diapositives · 333 Views · Aug 23, 2014

Tips and Tricks. Calculating age in years. As usual more than one way. Old school ageinyrs = int ((date of interest- birth date)/365.25); works fine! Newer ageinyrs = intck (‘ year’,birth date, date of interest); works, but be careful! Newer still

Tips and Tricks - slide 1
01 / 9Tips and Tricks
1 / 17

Télécharger la présentation

Tips and Tricks
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Tips and Tricks Calculating age in years

  2. As usual more than one way • Old school • ageinyrs=int((date of interest- birth date)/365.25); • works fine! • Newer • ageinyrs=intck(‘year’,birth date, date of interest); • works, but be careful! • Newer still • ageinyrs=floor(yrdif(birth date, date of interest, `act/act´); • works too!

  3. Sample code – 1 of x *** create a test data set; data testing; informat name $3. bdaterundt future1 future2 yymmdd10.; format bdaterundt future1 future2 yymmddd10.; rundt=today(); future1='28Feb2024'd; future2='29Feb2024'd; input name bdate @@; datalines; MCB 1934-05-26 JLS 1932-12-15 PXS 1960-04-21 MXS 1962-06-06 SXS 1964-05-28 SAS 2001-10-21 RES 2005-02-01 RAN 1980-02-29 ; run;

  4. Sample code – 2 of x from VIEWTABLE of data: testing

  5. Sample code – 3 of x *** calculate the patient's age as of the date the program was run; data ages; set testing; *** on the run date of the program; age_m1=int((rundt-bdate)/365.25); age_m2=intck('year',bdate,rundt); age_m3=floor(yrdif(bdate,rundt,'act/act')); *** what about dates in the future?; age_m1_f1=int((future1-bdate)/365.25); age_m2_f1=intck('year',bdate,future1); age_m3_f1=floor(yrdif(bdate,future1,'act/act')); *** what about dates in the future leap years?; age_m1_f2=int((future2-bdate)/365.25); age_m2_f2=intck('year',bdate,future2); age_m3_f2=floor(yrdif(bdate,future2,'act/act')); run;

  6. Printout of results: Age at run date (2013-10-17)

  7. Age on 2024-02-28

  8. Age on 2024-02-29

  9. All methods work … but • Careful of using the intck function when calculating age • this function was developed to determine intervals for time series analysis and may round data in ways that aren’t intuitive for age calculations