SDA 4.1 Documentation for SREPORT EXAMPLES


NAME

sreport examples - examples of command files for SREPORT

DESCRIPTION

Some examples of command files and the output they produce are given below. The variables are taken from the test dataset distributed with the SDA programs.

Each of the following examples is given in two parts. First the final output is shown. Then the corresponding SREPORT command file is given.

The following examples are included (each is a BREAKVAR type of report, except for the first):



1. Example of a Basic ROWVARS Report


                     Example of a ROWVARS Report



          Variable                Mean       Std Dev       Valid N
          --------------------------------------------------------

          spend                    1.9          1.19         1,094
          Military spending

          spend2                   4.2          1.22         1,068
          Urban problems spending

          spend3                   4.3          1.09         1,079
          Crime reduction spending


          Report date: March 12, 2011

Command File that Produced the Above Report

          # Example of a ROWVARS type of report

          data = testdat
          ddl = testddl
          savefile = row1.out

          rowvars = spend spend2 spend3

          *COLUMNS
          &name    MEAN    STDDEV  NVALID
          &label

          *HEADER

                     Example of a ROWVARS Report



          Variable                Mean       Std Dev       Valid N
          --------------------------------------------------------

          *ROWS
          LLLLLLLLLLLLLL      XX,XXX.X        XXX.XX       XXX,XXX
          LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

          *FOOTER

          Report date: &date
          *END

2. Example of a Basic BREAKVAR Report

                           Example of a BREAKVAR Report

                                  Mean        Std Dev      Mean
                                   Age          Age      Education
           gender

            1  Male               40.5        15.55        14.4

            2  Fem                40.8        16.17        14.0
                               -------     --------    --------
           Total                  40.6        15.87        14.2

Command File that Produced the Above Report
          # Example of a BREAKVAR type of report

          breakvar = gender
          data = testdat
          ddl = testddl
          savefile=brk1.out

              # Specification of variables
          &a = age
          &b = educ

          &c = mean(&a)
          # mean of the variable &a (age)
          &d = stddev(&a)
          # standard deviation of &a
          &e = mean(&b)
          # mean of &b (education)

          *COLUMNS
          &cat  &label  &c &d &e
          *ROWS

          XXX  LLLLLLLLLL      X,XXX.X     X,XXX.XX    XX,XXX.X
          *TOTAL    # template for a row of totals   (optional)
                               -------     --------    --------
           Total               X,XXX.X     X,XXX.XX    XX,XXX.X

          *HEADER
                           Example of a BREAKVAR Report

                                  Mean        Std Dev      Mean
                                   Age          Age      Education
           &name
          *END

3. Example of a Banner Run


                                  Example of a "Banner" Run

                                  Gender                    Age
                             (M)         (F)       (18-40)      (41-96)
       Military spending

         1 too much         57.6         61.6         65.2         51.6

         3 abt ok           36.8         33.3         30.5         41.4

         5 too litl          5.6          5.2          4.3          7.0
                          ___________________       ___________________
       Totals             100.0%       100.0%       100.0%       100.0%

       (Number)            (514)        (580)        (653)        (430)

Command File that Produced the Above Report

       # Example of a "Banner" Run

       data = testdat
       ddl = testddl
       BREAKVAR = spend
       &a = gender
       &A = FREQUENCY(&a,1)
       &B = FREQUENCY(&a,2)
       &b = age
       &C = FREQUENCY(&b,18-40)
       &D = FREQUENCY(&b,41-96)
       &F = COLPCTN(&A)
       &G = COLPCTN(&B)
       &H = COLPCTN(&C)
       &I = COLPCTN(&D)
       *COLUMNS
       &CAT  &CLABEL   &F     &G     &H     &I
                       &A     &B     &C     &D
       *HEADER everypage
                                  Example of a "Banner" Run

                                  Gender                    Age
                             (M)         (F)       (18-40)      (41-96)
       &LABEL

       *ROWS
       XXX LLLLLLLL        XXX.X        XXX.X        XXX.X        XXX.X
                            BBB          BBB          BBB          BBB
       *TOTAL
                          ___________________       ___________________
       Totals             XXX.X%       XXX.X%       XXX.X%       XXX.X%

       (Number)          (X,XXX)      (X,XXX)      (X,XXX)      (X,XXX)

4. Example of a 3-variable Table


                                 Example of a 3-variable Table

                                  Male                     Female
                           18-40        41-96        18-40        41-96
       Military spending

         1 too much         60.9         53.3         69.2         50.2

         3 abt ok           33.3         41.2         27.9         41.6

         5 too litl          5.8          5.5          2.9          8.2
                          ___________________       ___________________
        Total             100.0%       100.0%       100.0%       100.0%

        (Number)           (312)        (199)        (341)        (231)

Command File that Produced the Above Report
      # Example of a 3-variable table, using the BIFREQUENCY function

      data = testdat
      ddl = testddl
      BREAKVAR = spend
      &a = age
      &b = gender
      &A = BIFREQ(&a,18-40; &b,1)
      &B = BIFREQ(&a,41-96; &b,1)
      &C = BIFREQ(&a,18-40; &b,2)
      &D = BIFREQ(&a,41-96; &b,2)
      &F = COLPCTN(&A)
      &G = COLPCTN(&B)
      &H = COLPCTN(&C)
      &I = COLPCTN(&D)
      *COLUMNS
      &CAT  &CLABEL      &F     &G     &H     &I
                         &A     &B     &C     &D
      *HEADER everypage
                                 Example of a 3-variable Table

                                  Male                     Female
                           18-40        41-96        18-40        41-96
       &LABEL

      *ROWS
       XXX LLLLLLLL        XXX.X        XXX.X        XXX.X        XXX.X
                            BBB          BBB          BBB          BBB
      *TOTAL
                          ___________________       ___________________
        Total             XXX.X%       XXX.X%       XXX.X%       XXX.X%

        (Number)         (X,XXX)      (X,XXX)      (X,XXX)      (X,XXX)


5. Example of Differences and Ratios


                                 Example of Differences and Ratios

                                Gender               Diff        Ratio
                          Males       Females       (M-F)        (M/F)
      Military spending

        1 too much         57.6         61.6         -4.0         0.94

        3 abt ok           36.8         33.3          3.5         1.11

        5 too litl          5.6          5.2          0.5         1.09
                         ___________________
      Totals             100.0%       100.0%

      (Number)            (514)        (580)      (1,094)      (1,094)

Command File that Produced the Above Report
      # Example of Differences and Ratios

      data = testdat
      ddl = testddl
      BREAKVAR = spend
      &a = gender
      &A = FREQUENCY(&a,1)
      &B = FREQUENCY(&a,2)
      &F = COLPCTN(&A)
      &G = COLPCTN(&B)
      &M = SUBTRACT(&F,&G)
      &N = DIVIDE(&F,&G)
      &O = ADD(&A,&B)
      *COLUMNS
      &CAT  &CLABEL   &F     &G     &M     &N
                      &A     &B     &O     &O
      *HEADER everypage

                                 Example of Differences and Ratios

                                Gender               Diff        Ratio
                          Males       Females       (M-F)        (M/F)
      &LABEL

      *ROWS
      XXX LLLLLLLL        XXX.X        XXX.X        XXX.X        XX.XX
                           BBB          BBB          BBB          BBB
      *TOTAL
                         ___________________
      Totals             XXX.X%       XXX.X%         BBB          BBB

      (Number)          (X,XXX)      (X,XXX)      (X,XXX)      (X,XXX)


SEE ALSO

sreport Basic information about SREPORT
sreport batch Commands for batch mode
sreport functions Summary of SREPORT functions and formats
DDL Data description language


CSM, UC Berkeley/ISA
March 18, 2019