pc.s
Substitutes values for nulls or zeros.
Syntax
s;attrnum1;attrnum2 s;'text';'text' s;*;'text'
Description
substitutes either a data value from the referenced attribute or literal text when the current data value is null or zero.
The 's' processing code returns the value defined by 'attrnum2' if the value for conversion is null or zero. Otherwise, the value of 'attrnum1' is returned. 'attrnum1' and 'attrnum2' may both be an attribute number or text string.
The '*' is used to display the original data value, if it is not null or zero. Otherwise, the second argument is displayed. This feature may be embedded within an 'f' processing code in the form: fattrnum(s;*;'text') It also may be embedded within an 'a' processing code.
Example
Substitution is used in an 'a (algebraic)' processing code as an
alternative to the THEN/ELSE construct.
The following A correlatives produce identical results:
aif n(sales)>='1000000' then 'made it' else
'trouble'
a(n(sales)>='1000000')(s;'made it';'trouble')
The following checks for the existance of a shipping address in attribute 20.
If not there, show the billing address in attribute 10.
a(20)(S;*;10)
See Also
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
