Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Keywords for data analysis > Base elements
 
Base elements
Base elements count the number of people who were asked a question. If the questionnaire routing means that some questions do not apply to some respondents, the base for those questions will be lower than for questions that everyone is asked. The UNICOM Intelligence analysis applications automatically create base elements for all questions that do not have them, so you do not have to define base elements unless you want the base to be something other than “all asked”.
You can manually exclude certain respondents from the base. For example, when a question can be left unanswered you might want the base to be “all answering” rather than “all asked”. In this case, you can flag the No Answer response so that it will not be included in the base.
You can also create your own base elements. This is most often necessary when you create a new analysis variable based on data from an interview question. If necessary, you can hide these elements if they are required only because the analysis variable contains statistics.
Using an axis block
To create a base element, place the following statement in the axis block for the question:
Name ['Text'] base('Expression')
where:
Name is the name for the base element.
Text is the text you want to display for the base in analyses. The default is Base.
Expression is an expression defining who should be included in the base.
Here is an example. The routing section (not shown) sets Gender.MustAnswer to False so that respondents can click Next without answering. When this happens, the na response is written to the data file. In analyses, we want to see only those respondents who gave their gender. We do not want to see those who chose not to answer.
' The routing section contains Gender.MustAnswer=False.
' Respondents who click Next without answering are automatically
' coded as GenderNA. This response is not displayed during
' interviews.
Gender "Are you ...?" categorical[1..1]
{
Male, Female,
GenderNA "No answer" na
}
axis(
"{
..,
GenderNA [IncludeInBase=False, IsHidden=True]
}"
);
Notice the way the condition for inclusion in the base element is defined. The * means “Contains Any”, so the base will count anyone who chose either Male or Female at the Gender question. It will exclude everyone else.
Using an Analysis element
You can also create base elements in the main part of a categorical response list by writing a statement that includes elementtype(AnalysisBase). To do this, place the following statement in the response list at the point you want the base to appear in analyses:
Name ["Text"] elementtype(AnalysisBase) expression("Expr")
where:
Name is the element’s name.
Text is the text you want to display for the base in analyses (that is, the row or column heading).
Expr is an expression that defines who to include in the base.
The following example shows an analysis-only variable that is derived from a numeric question that records the number of children in a household. Only people who said they have children at home are asked how many they have.
NumChildBanded "Number of school-age children in household"
categorical [1..1]
{
Base elementtype(AnalysisBase) expression("NumChild IS NOT NULL"),
One "1 child" expression("NumChild = 1"),
TwoThree "2 or 3 children" expression("NumChild = 2 Or NumChild = 3"),
FourMore "4 or more children" expression("NumChild >= 4")
};
Excluding elements from the base
To exclude elements from a base element set its IncludeInBase property to False in the question’s axis block. You might to do this if you are using the default base since, if you create the base yourself, you can specify who to include in it. Define the excluded element as:
Name ['Text'] [IncludeInBase = False]
For example:
Gender "Are you ...?" categorical [1..1]
{
Male, Female,
GenderNA "No answer" na
}
axis (
"{
Male, Female,
GenderNA [IncludeInBase=False]
}"
);
Excluding an element from the base does not hide that element in the tables. To do this, set the element’s IsHidden property to True:
GenderNA [IncludeInBase=False
  IsHidden=True]
See Hiding interview-only elements for further information about hiding elements in tables.
See also
Keywords for data analysis