⚡ Quick Formula (TL;DR)

In CDISC SDTM (Demographics domain DM), age at informed consent must be calculated using the continuous year difference function YRDIF with the 'ACT/ACT' basis, rounded down:
AGE = floor(yrdif(brthdt, rfstdtc_num, 'ACT/ACT'));

VISUAL GUIDE: CDISC SDTM AGE DERIVATION LOGIC 1. Raw CRF Inputs BRTHDTC : 1980-05-15 RFICDTC : 2024-03-10 (ISO 8601 Strings) INPUT() 2. SAS Numeric Dates BRTHDT = 7440 RFICDT = 23445 YRDIF = 43.82 yrs FLOOR() 3. SDTM DM Dataset AGE = 43 AGEU = 'YEARS' ✔ Regulatory Ready

Why Common Date Arithmetic Fails in Clinical Trials

A frequent error by programmers entering clinical trials is subtracting dates directly and dividing by 365.25:
AGE = (RFICDT - BRTHDT) / 365.25; /* ❌ Non-compliant */

This approach produces leap-year boundary rounding errors that FDA and PMDA submission validation tools (Pinnacle 21) will flag. The standard CDISC implementation requires the YRDIF function.

The Production-Grade SAS Code

DATA sdtm.dm;
    SET raw.demog;
    
    /* 1. Convert ISO 8601 character dates to SAS numeric dates */
    brthdt = input(brthdtc, yymmdd10.);
    rficdt = input(rficdtc, yymmdd10.);
    
    /* 2. Compute exact completed years at consent */
    if brthdt ne . and rficdt ne . then do;
        age  = floor(yrdif(brthdt, rficdt, 'ACT/ACT'));
        ageu = "YEARS";
    end;
RUN;

Build Real CDISC SDTM, ADaM & TLF Clinical Deliverables

Learn end-to-end clinical trials data analysis, protocol-specific safety tables, and CDISC standards from an experienced biometrics lead.

Explore Clinical SAS Masterclass →