Numbered Quota Type
Numbered quotas are updated with the quota subtype REGULAR_NUMBERED statement. Since the number of the quota to update can be constructed and placed in the data, you only need to have one (or a few) quota update statements to access all of your quotas. Also, while you can have up to 3,000 named quotas, you may have many times more numbered quotas. You must specify the highest number you will be using for your numbered quotas with the MAXIMUM_QUOTA_NUMBER option in your Header statement. The highest supported number quota is 2,000,000,000, however each cell takes up about 40 bytes of disk space, so on most systems there is a much lower practical limit usually around 100,000,000.
The syntax for Numbered Quotas is:
!QUOTA,REGULAR_NUMBERED,<number of quota,question label,data location>,#
The easiest way to use numbered quotas is to set up a numbering scheme so you can easily determine which quota cell you are working on. Disk-based FIELD questions are often used as the structure to capture the numbered quota number to be updated.
Suppose you have a quota scheme that is sex by three age groups by each of the 50 states. This will produce 300 quota cells (2 x 3 x 50). You can use the two digits of the number for the state reference (codes 01 thru 50 for the 50 states), use a digit to tell you which sex (1 or 2), and use a digit to tell you which age group (1-3). You can also set up target quotas for each quota by adding a digit on the front (e.g., 1 for quota, 2 for target).
By storing these codes in consecutive data positions, you can use a disk-based FIELD question, EXPRESSION statement, or data location to reference this constructed quota cell number, e.g., !QUOTA,REGULAR_NUMBERED,[9.5],1, if the quota type (quota or target) was in column 9, state codes were in columns 10-11, sex in column 12, and age group in column 13. Using this scheme, the quota for Alabama, male, young age would be 10111, and its target would be 20111.
The example below shows how to collect, store, check, and increment the numbered quota cells.
EXAMPLE:
''Get quota related info (as numbers in consecutive columns) { QSTATE: Enter a 2 digit number associated with state !FIELD 01 Alabama 02 Alaska . . . 50 Wyoming } { QSEX: Enter sex of respondent !FIELD 1 Male 2 Female } { QAGE: Enter age of respondent !FIELD 1 18-35 2 36-54 3 55-70 } ''Set up a question to hold the numbers as the ‘quota number’. { QUOINFO: [QSTATE.4] !VARIABLE,USE_PREVIOUS_ANSWER,4,4 } { QNUMQUO: .5 !EXPRESSION,,[QUOINFO] + 10000 } { QTARGQUO: .5 !EXPRESSION,,[QUOINFO] + 20000 } ''Display the quota if it's full and go to end { XDISPLAY: !IF QUOTN(QNUMQUO)>=QUOTN(QTARGQUO) QUOTA Number=\:QNUMQUO: SEX=\:QSEX: AGE=\:QAGE: STATE=\:QSTATE: IS FULL Thank the respondent and Press Enter to continue !DISPLAY } { XGOTO: !IF QUOTN(QNUMQUO)>=QUOTN(QTARGQUO) !GOTO,XENDIT } BODY OF QUESTIONNAIRE ‘’Update the quotas at the end { XQUOTA: !QUOTA,REGULAR_NUMBERED,QNUMQUO,1 } { XENDIT: !GOTO } ~END
This example gets the relevant information, then appends a 1 or 2 to the four-digit number to reference the quota and target (e.g., 12123 and 22123) using EXPRESSION statements. Then the QUOTN function is used to compare the values of the quotas specified. The same kind of logic is used for the rest of the questionnaire as for standard quotas. Note that only one QUOTA statement is needed since we can generate numbers to reference the correct quota. Standard quotas require a conditional quota update statement for each named quota.
Numbered quotas do not affect the normal operation of named quotas, so you can have both in the same questionnaire.
Numbered quotas also understand a specific quota number specified as the quota to increment.
EXAMPLE:
{!QUOTA,REGULAR_NUMBERED,1234,5 }