gender
Returns the gender for the input name. Possible results are 'male', 'female', and 'none'.
The names are taken from a census database of American first names. For names assigned to males and females, the function returns the most common gender for the name.
Parameters
NAME (string)
The input name.
Examples
ATL in Script | Result |
---|---|
| male |
| female |
| female |
| male |
| none |
You could write a user-defined function (UDF) to get 'unknown' (or any other string) instead of 'none'.
#value getGender(name) [[gender(name) == 'none' ? 'unknown' : gender(name)]]
This content creates a UDF called getGender
. The UDF takes one parameter (name
), to which you input the name in STRING form. The UDF uses gender
to check if the gender is 'none'. If true, it returns 'unknown'. If false, it runs the name through the gender
function, meaning it returns 'male' or 'female'. For example:
ATL in Script | Result |
---|---|
| female |
| male |
| unknown |