         





            If you ever wanted to use your
         TRS-80 Model I or III to tabulate
         opinions for your favorite political
         candidate or election results for a
         local service club, then MicroTab (see
         the Program Listing), a general-pur-
         pose cross-tabulation. program, will in-
         terest you. MicroTab gives you low-
         cost, accurate, easy-to-understand
         tables. With it you can run many dif-
         feret tabulation projects without
         special programming.

         Back to Basics
            To produce a finished table, you
         need a set of completed question-
         naires (see Fig. 1) and a drawing of the
         way you want your table to look.
         Figure 2 illustrates how a skeleton
         table might look for a political prefer-
         ence poll.
            Lets say you interviewed 20 pro-
         spective voters to see whether they are
         leaning toward candidate Smith or
         candidate Jones. You now want to.
         make a table that divides the results
         according to the respondents sex.
            To do this by hand, youd have to
         draw a table on a piece of paper, then
         go through each questionnaire and
         make a check mark in the appropriate
         intersection of the rows and columns
         in the table. After examining all the
         questionnaires, you would then total
         each column and enter the result in the
         total row at the bottom. Then you
         could calculate percentages based on
         each column total. This procedure is
         fine for one or two tables, but suppose
         you want to make 10 different tables.
         You can imagine the tedium involved.
         
         Enter Micro Tab
            MicroTab automatically goes
         through the procedure outlined above.
         You specify what you want the table
         to look like, enter the questionnaire
         data, and let the program count the
         responses and calculate the percent-
         ages. In addition to column per-
         centages, MicroTab computes row
         percentages.
            It also gives you several printing op-
         tions (see Fig. 3): raw counts (frequen-
         cies), column percentages, row per-
         centages, no data (useful for printing
         labels alone), or no print (used for
         





               dummy rows where you calculate r-
               sults but dont want to show the data
               or label).
                The number of  questionnaires
               MicrOTab processes depends on the
               length of the questionnaire and the
               amount of memory in yOur computer.
               Experimentation is the best bet for de-
               termining the capacity of your system
               for a particular tabulation project.
                The Program is designed to accom-
               modate a 132-column printer. It
               doesnt display tables on the screen
               because of its small size. If you need,
               you can change the LPRINTs to
               Prints Or divert the
               screen with POKEs.
               program can display only very small
               tables on the screen. POKE 16422,88:
               POKE 16423,4 diverts printer data to
               the screen on the Model 1. POKE
               16422,141 : POKE 16423,5 restores
               normal printer operation,
         
               Using Micro Tab
         
                The program consists of two com-
               ponents. The first (lines 102350)
               takes care of calculations and print-
               ing. You normally wouldnt change
               this . part of the program unless you
               , need custom modifications.
               The second component consists of
               data statements that the user adds to
               the program. They contain the
               specifications for the table and all the
               questionnaire data. To change a table
               or run a new one, change the data
               statements and their specifications,
               but leave the questionnaire data
               alone. If you have a Merge utility, you
               can set up specifications for several
               tables in files (disk or tape), then
               merge them into the program as
               needed.
         
                The specification part of the pro-
               gram has several sections: Lines
               3000-3999, are the table column
               specifications; lines 40004999 are the
               table row specifications; lines 5000
               5999 are the table title section; lines
               60006999    are the column titles sec-
               tion; lines 70007999 are the row titles
               section; and lines 80008999 are the
               row print options. Line 9040 contains
               the number of questionnaires and line
               9090 contains the number of questions
               per questionnaire. Line 9140 contains
               the row to base column percentages on
               and line 9190 .contains the column to
               base row percentages on.
         
               The table column specifications sec-
               tion contains the specifications for
               each of the columns that appear in the
               table. For example, in Fig. 2 the first
               column is Women, the second is Men,
               and so on. The specIfications them-
               selves consist of regular statements in
               Basic. They must follow a certain for-.
               mat, however. First, each statement
              identifies the table column (COL n).
                                    Next, the program determInes:
         whether the answer to a particular
         question in the questionnaire qualifies
         to go in that column. The format is IF
         Q(x) = y THEN GOSUB 4060, where
         x is the question number and y is the
         value to be tested for. If the test is suc-
         cessful, then the program executes the
         GOSUB, which goes to the row tests.
         You can use any relational operator
         permitted by Basic in place of the
         equal sign.
            An example will illustrate the pro-
         cedure. Lets say you want the first
         column in the table to be for women.
         Further, lets suppose that the third
         question in the questionnaire gives the
         sex of the respondent, with a one
         meaning a woman and a two meaning
         a man. The specification, then, would
         be written this way: 3060 COL = 1 :IF
         Q(3) = 1 THEN GOSUB 4060.
            Write all column specifications in a
         similar manner. Just remember that:
         you have to give the column number,
         the question number, and, question
         value.
            Row specificatl9ns are similar to
         column specifications. They tell
         program which row you are working
         with and what qualifies to go in that
         row. Their format is ROW =n: IF
         Q(x)=y THEN GOSUB 2200, where
         n is the number of the row, x is the
         question number, and y is the value
         the program tests. If the test is met
         the program goes to the section where
           it tallies answers (lines 22002210).
            For example, the first row in the
         table is for Smith, and the first ques-
         tion in the qUestionnaire asks which
         candidate respondents favor, with a
         one meaning Smith and a two sighify-
         ing Jones (see Fig. 1). The specifica-
         tion for this row is 4060 ROW =1: IF
         Q(1) = 1 THEN GSUB 2200. Write
         all row specifications in a similar way.
         The program operates by testing each
         column. If the column test is met, it
         then tests all the rows, putting a tally
         mark on its imaginary tally sheet in
         each row/cOlumn intersection where
         that test is, successful.
            The table titles section lets you put
         titles on your tables. Such titles might
         be Table 1 or Public Opinin
         Poll. Simply enter each title as a data,
         statement, with one title per stat-
         ment. The maximum length is 110
         charactersthe program truncates
         anything longer. The maximum
         number of titles is 20.
            Column titles are the labels of the
         columns in the table. Enter each title
         as a data statement (only one title per
         statement). Be sure the number
                                                   I
                                                   I
                  





         titles matches the number of column
         specifications or an error results. The
         maximum title length is 40 characters.
            The program automatically wraps
         around and stacks column titles as it
         needs to. This may lead to some
         strange-looking word breaks. Prevent
         that by inserting spaces in the
         titleexperiment to see what I mean.
         The maximum number of columns is
         10. This assumes a 132-column
         printer. Use fewer columns if your
         printer wOnt go that wide.
            The row titles section operates like
         the column titles section. Enter row
         titles as data statements. The maximum
         row title length is 20 characters, and the
         maximum number of rows is 50.
            The row print specifications let you
         determine the data printed in each row
         of the table. Figure 3 lists the options.
            Enter the specifications as data
         statements in row order. Make sure
         the number of print specifications
         matches the number of row titles. Be
         sure to put a comma between each op-
         tion and terminate the print options
         for each row with the word END.
            As long as there is no conflict, each
         row specification may contain one or
         more options in any order. For ex-
         ample, the statement FREQ,COL
         7o,ROW 7o prints the tally, column
         percentage, and row percentage in
         that order. You can use a maximum
         of three options at one time per row.
            Enter the number of questionnaires
         you want to tabulate in line 9040.
         Then put the number of questions per
         questionnaire in line 9090. MicroTab
         uses this information to perform some
         gross checking on the questionnaire
         data.
            Type the number of the row you
         want to use as a base for column
         percentages in line 9140. Do the same
         for row percentages in line 9190.
         Enter these two numbers even if you
         dont plan to use column or row
         percentages.
            If you want to alter a specification,
         simply edit the appropriate line
         number. If you want to make a new
         table, then alter only those specifica-
         tions that need to be changed. For ex-
         ample, if you use the same set of table
         columns (header) for many tables,
         then change the row specifications.
         
         Entering the Data
          Lines 10000 onward contain the
          data for each questionnaire in data
          statements. The program is set up so
          that all questionnaire data must be in-
           teger numbers in the range of  32768
            to 32767, with the exception of a
            minus one, which is used as an end-of-
            questionnaire marker. This means
            that any question may have somewhat
            more ;than 65,000 possible answer
            categories. While no one would use
            that many, it illustrates the programs
            flexibility.
              Enter a number for each question
            even if it would be a blank. This is best
            handled by assigning a certain number
            : to indicate a blank. As with any data
            statement, separate each number with
            a comma. You can spread a question-
            naire over any number of data
            statements. Of course, the longer the
            questionnaire, the fewer you can get into
            the computer.
              Signify the end of a questionnaire
            with a negative one. The program uses
            such a marker to ensure that a data
            element is not dropped somewhere.
              Since the data is the last part of the
            MicroTab program, you dont need to
            worry about running into other parts
            of the program as you add data. I
            usually start the numbers with 10001
            and increase it in increments of one. If
            you enter the questionnaires in their
            numerical order, its easy to cross-
            check data.
         
            Running the Program
         
              After you enter all your specifica-
            tions and data, type RUN. The pro-
            -gram displays a menu that allows you
            to edit the specifications or process
            the data into a table. If you choose an
            editing function, you have to type
            RUN again when you finish. Be sure
            your printer is ready when you select
            the Run Table option.
              Several errOr traps in the program
            catch mistakes in the specifications or
            data. They trap most but not all er-
            rors. Figure 4 shows an example of a
            finished table.
                  