02 Dict Forms Continued

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Session 2: Dictionary and Forms Continued

At the end of this lesson participants will be able to:

 Use dictionary macros to work with dictionaries in Excel.


 Create items with subitems.
 Use items with multiple occurrences and occurrence labels.
 Use the different capture types: radio buttons, combo boxes, date picker and check boxes.

Dictionary Macros
There are some useful functions for working with dictionaries that you can access by right-clicking on
the dictionary in the tree on the left side of the screen and choosing “Dictionary Macros”. In particular
you can copy/paste all value sets or all item names/labels from the dictionary to/from Excel. This can be
used to create codebooks to share with people who do not have access to CSPro. It can also be used to
do bulk modifications on dictionary items such as renumbering values in value sets or adding prefixes to
item names.

Subitems
Let’s revisit the date of birth field (B6). We implemented this as two variables in order to be able to
enter month and year separately. In order to be able to look at both the date as a 6 digit number and
look at the month and year individually we can make this a single item with subitems. Subitems are
items that are made up of a subset of the digits of their parent item. Add the item for birth date and the
following subitems:

 Month of birth (length 2)


 Year of birth (length 4)

Click on Layout in the toolbar to ensure that the item and subitem overlap. Add the subitems to the
form, add the value sets for each subitem and test the application. Note that when we add the subitems
to the form we do not need keep the same order that we have in the dictionary. On the form we can put
the month then the year or year then month.

Multiply Occurring Items


Let’s add question H68 on number of housing units to the application. Since this question asks the
number of units of each of eight different types we could make eight different variables in the
dictionary: HOUSING_UNITS_RONTABOLE, HOUSING_UNITS_HEISI, HOUSING_UNITS_POLATA etc… To
simplify our dictionary we can instead make a single variable in the dictionary with eight occurrences:
one for each type of housing unit. When we drag this variable onto the housing characteristics form we
will get a roster with 8 rows.

1
With this approach our form does not show the housing unit types but we can fix that by using
occurrence labels. Select the housing units variable in the dictionary and choose “Occurrence Labels…”
from the Edit menu. Add the names of the eight types of housing units in the grid that comes up. Note
that you can copy from Excel and paste into this dialog. Now when we drag the variable to the form the
roster shows the type of housing unit for each row.

We can also use multiply occurring items for question H69 (number of rooms) and H80 (number of
animals).

Checkboxes
We could also use a multiply occurring item for question H77, household items, but that can be
implemented more easily using checkboxes. Checkboxes offer a friendly interface for multiple response
questions by presenting a single screen with a checkbox for each option rather than presenting the
options one by one.

In CSPro multiple response questions are implemented as alpha variables whose length is the same as
the number of options that can be selected at once. The value set has a value for each option which is
usually a single letter. The resulting value is a string containing the values for each of the selected items.

For household items we will use the following value set:

Radio A
Landline Telephone B
Cellular phone C
Television D
Tractor E
Electric/Gas/Coal stove F
Scotch Cart G
Bed/Mattress H
Computer/Laptop I
Access to Internet J
Vehicle K
Generator L
Refrigerator M
Other (specify) N

If the interviewer checks the boxes for Radio, Television and Tractor the value for the variable will be
“ADE”. We will see later how can convert the alpha value into a series of yes/no values to simplify
analysis.

Capture Types
If you right click on the household items field on the form and choose “Field Properties…” you will see
that the capture type is set to check box. There are other capture types:

2
 Text Box: keyboard data entry
 Radio button: choose one option from many with radio button for each option
 Drop Down: choose one option from many without radio buttons.
 Combo Box: combination of keyboard input and drop down (same as drop down on Windows)
 Check Box: choose multiple responses

When you drag an item on the form CSPro sets the capture type based on the value set for that item. If
there is no value set when you drop the item the capture type will be set to checkbox. You can always
change the capture using the Field Properties dialog.

Date Fields
Let’s add the visits to the identification section. We can create a new record for the visits (we could also
just add them to the housing record). We can have up to 3 visits so we will use a roster and an
occurrence control field. Add a one digit numeric item for the number of visits with a value set of 1-3
and add an eight digit item for the visit date with three occurrences. We can also add sub-items for the
year, month and day of the visit. Drag both items onto the form and set the number of visits as the
roster occurrence control field. When dragging don’t use the sub-items, just the items. Now change the
capture type for the visit date to be Date and set the date format to be YYYYMMDD to match the order
of the sub-items year, month and day).

Exercises
In your teams, finish the dictionary records and forms from yesterday. For the team working on the
housing record you can now add the items that were left out yesterday (H69 and H80). Make sure to
test your forms on Windows and Android.

You might also like