for and for current select a list of attributes or groups, provided that the condition specified by the ‘for’ or ‘for current’ expression is true.

The syntax is:

{ names } for (expression)

{ names } for current (expression)

where:

names is a comma separated list of attribute or group attribute names,

expression is the condition that must also be satisfied.

With ‘for current’ the expression is evaluated against the most recent episode, whereas with ‘for’ the expression is evaluated on a per-episode basis.

A typical use of this function would be to create an age-dependent calculated value attribute. For example, you could define a calculated value attribute AllergensForInfants as

{milk, timothy, cat} for (age < 2)

and the case would then appear as:

age                        1
sex                        F
milk                       50.0
timothy                    63.5
cat                        64.6
AllergensForInfants        cat (64.6), timothy (63.5) and milk (50.0)

A comment could now be created that used the expression AllergensForInfants. For a case where the age was greater than 2, AllergensForInfants would be empty. Similarly, we could define another calculated value attribute for people aged two or more as:

{peanut, birch} for (age >= 2)

We could combine these two expressions into a single expression covering all ages using the union
syntax as follows:

{milk, timothy, cat} for (age < 2) union {peanut, birch} (50, 100] for (age >= 2)

To better understand the difference between ‘for’ and ‘for current’ consider this case:

age                        1                5
sex                        F                F
milk                       50.0             1250
timothy                    63.5             12.0
birch                      44.6             60.0

If we define a Calculated Value Attribute with expression

{milk, birch, timothy} in range [ 50 , 500 ] for age > 2

then this would evaluate as “” (blank) for the first episode and “birch (60.0)” for the second episode.

If however we define a Calculated Value Attribute with expression

{milk, birch, timothy} in range [ 50 , 500 ] for current age > 2

then this would evaluate as “timothy (63.5) and milk (50.0)” for the first episode and birch (60.0) for the second episode.

See also:

in range…for…

union