Subitems allow
items to be broken up into smaller pieces, or across broad categories. In this respect, they let you redefine data items and refer to the same data field in several different ways. The start position of a subitem must be within its parent item.
One useful application of subitems involves date and time fields. A date item, for example, could be referred to as a single 8-digit entity: YYYYMMDD. However, this does not allow you to easily manipulate or refer to a portion of the date (such as the year, month, or day itself). Suppose you had the following definition for date (for demonstrative purposes, only selected item properties are shown):
Item Label | Item Name | Start | Len | Item Type |
Date of birth | DOB | 20 | 8 | Item |
To redefine this item into subitems, you only need to add the following subitems:
Item Label | Item Name | Start | Len | Item Type |
Year of birth | DOB_YEAR | 20 | 4 | Subitem |
Month of birth | DOB_MONTH | 24 | 2 | Subitem |
Day of birth | DOB_DAY | 26 | 2 | Subitem |
Another reason for using subitems is to make data references available across larger categories. Censuses and surveys often have items of three or four digits in length representing categories such as industry, occupation, or ethnicity. For example, looking at occupation codes:
- the full value refers to a very detailed occupation, such as bus driver
- The first digit alone refers to the 'major' division, such as 'public service'
- The first two digits together refer to a more detailed 'major' division, such as 'public transportation'
It may be useful to test the ranges with the CSPro language at the item level. In
tabulation applications, tables can be made at the major (1- or 2-digit) or minor (3- or 4-digit) divisions. The following example could represent part of an economic survey:
Item Label | Item Name | Start | Len | Item Type |
Occupation | OCCUPATION | 45 | 4 | Item |
Occupation, Major | OCC_MAJOR | 45 | 1 | Subitem |
Occupation, Sub-major | OCC_SUBMINOR | 45 | 2 | Subitem |
Occupation, Minor | OCC_MINOR | 45 | 3 | Subitem |
Note: Identification items cannot have subitems.