FIRST_NUMERIC_VALUE(): pick the first available value and return it as Numeric

Modified on Fri, 20 Feb at 10:27 AM

first_numeric_value() scans several variables from left to right and returns the numeric value of the first one that is not null. It is a simple way to build one analysis-ready numeric variable from multiple possible sources, without writing complex scenario logic.


Syntax

first_numeric_value(Var1, Var2, Var3, ...)
  • Inputs can be List, Yes-no, or Numeric (mixing is allowed)

  • Output is always Numeric

  • Evaluation order is left → right (priority order)


What it returns (quick rules)

  • Numeric input → returns the value as-is

  • List input → returns the numeric code of the selected modality

  • Yes-no input → returns the EMS numeric convention (typically 1/0)

  • All inputs null → returns null (shown as “NC” in the eCRF)

If more than one input is non-null, the function returns the first one based on argument order.


Multilingual studies (quick reminder)

If you collect the same List question in multiple languages, you can extract the common numeric code:

SmokingCode = first_numeric_value(Smoking_EN, Smoking_FR, Smoking_DE)

Then convert to a single reference language using map_numeric_to_list() (described in the dedicated helper page).


Practical examples beyond multilingual studies

1) Choose the best available source (fallback logic)

Use the priority order you want for analysis:

PainScore_Final = first_numeric_value(PainScore_ePRO, PainScore_CRF, PainScore_Device)

2) Harmonize variable versions (form update mid-study)

Prefer the newest version when available:

QoL_Item3 = first_numeric_value(QoL_Item3_v2, QoL_Item3_v1)

3) “Most recent available” across visits (missing timepoints)

Put the most recent visit first:

Bleeding_AnyRecent = first_numeric_value(Bleeding_Day28, Bleeding_Day14, Bleeding_Day7)

4) Keep analytics stable during migration / renaming

Use new ID first, then old ID:

BMI_Analysis = first_numeric_value(BMI_New, BMI_Old)

5) Combine different question types into one numeric signal

Mix Yes-no, List, and imported Numeric codes:

SmokerCode = first_numeric_value(Smoker_YesNo, SmokingStatus_List, SmokerCode_Imported)

6) Prefer measured values, fallback to self-reported

Common for vitals:

Weight_Analysis = first_numeric_value(Weight_Measured, Weight_SelfReported, Weight_LastKnown)


Tips and common pitfalls

  • Order matters: put your preferred source first.

  • For List variables, keep numeric codes stable over time, especially if the study is already live.

  • If you expect multiple sources to be filled at once, define a clear priority order (left-most wins).

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article