The MCHP SAS MANUAL - Tables (Output)

         

Home    Contents

GENERAL GUIDELINES:
Windows in SAS
File management

The SAS Program
Program syntax
Debugging tips


 USING SAS PROGRAMMING TO: 
   
1. Prepare the data set 
   Types of data 
   Example programs    
    
2. View the data
   SAS Procedures
  
3. Explore the data  
   Numeric statistics    
   Frequency tables    
    
4. Manipulate the data  
   Basic techniques    
   New variables
  
5. Adding Variables and 
Observations to Data Sets
   The SET Statement
   The MERGE Statement

6. Data Processing
   ARRAY Statement
   Do Loops
   By-Group Processing
   RETAIN Statement
  
NON-PROGRAMMING 
      Alternatives

 
SAMPLE DATA SETS: 
 Height/weight
 Height/weight/region
 Simulated clinical data 
 Simulated Manitoba Health 
    

Tables - Output

                    PROC FREQ:  Example 1                    41
                     No keywords specified
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                                       Cumulative    Cumulative
name          Frequency     Percent     Frequency      Percent
---------------------------------------------------------------
Antonio              1        5.56             1         5.56
Aubrey               1        5.56             2        11.11
Carl                 1        5.56             3        16.67
David                1        5.56             4        22.22
Deborah              1        5.56             5        27.78
Donna                1        5.56             6        33.33
Elizabeth            1        5.56             7        38.89
Helen                1        5.56             8        44.44
Jacqueline           1        5.56             9        50.00
James                1        5.56            10        55.56
Joel                 1        5.56            11        61.11
Michael              1        5.56            12        66.67
Roger                1        5.56            13        72.22
Ron                  1        5.56            14        77.78
Ruth                 1        5.56            15        83.33
Susan                1        5.56            16        88.89
Tim                  1        5.56            17        94.44
Yao                  1        5.56            18       100.00


                                    Cumulative    Cumulative
    sex    Frequency     Percent     Frequency      Percent
    --------------------------------------------------------
    F             7       38.89             7        38.89
    M            11       61.11            18       100.00


                     PROC FREQ:  Example 1                    42
                     No keywords specified
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                                    Cumulative    Cumulative
    age    Frequency     Percent     Frequency      Percent
    --------------------------------------------------------
     23           1        5.88             1         5.88
     26           1        5.88             2        11.76
     28           1        5.88             3        17.65
     29           1        5.88             4        23.53
     30           2       11.76             6        35.29
     31           1        5.88             7        41.18
     32           2       11.76             9        52.94
     33           1        5.88            10        58.82
     34           1        5.88            11        64.71
     36           1        5.88            12        70.59
     39           1        5.88            13        76.47
     41           1        5.88            14        82.35
     42           1        5.88            15        88.24
     47           1        5.88            16        94.12
     53           1        5.88            17       100.00

                     Frequency Missing = 1


                                     Cumulative    Cumulative
  height    Frequency     Percent     Frequency      Percent
  -----------------------------------------------------------
      62           1        5.56             1         5.56
      64           1        5.56             2        11.11
      65           1        5.56             3        16.67
      66           2       11.11             5        27.78
      67           1        5.56             6        33.33
      68           1        5.56             7        38.89
      69           2       11.11             9        50.00
      70           2       11.11            11        61.11
      71           2       11.11            13        72.22
      72           3       16.67            16        88.89
      74           1        5.56            17        94.44
      75           1        5.56            18       100.00
                     PROC FREQ:  Example 1                    43
                     No keywords specified
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                                     Cumulative    Cumulative
  weight    Frequency     Percent     Frequency      Percent
  -----------------------------------------------------------
      98           1        5.56             1         5.56
     115           1        5.56             2        11.11
     121           1        5.56             3        16.67
     124           1        5.56             4        22.22
     131           1        5.56             5        27.78
     135           1        5.56             6        33.33
     139           1        5.56             7        38.89
     143           1        5.56             8        44.44
     145           1        5.56             9        50.00
     155           1        5.56            10        55.56
     158           1        5.56            11        61.11
     160           1        5.56            12        66.67
     163           1        5.56            13        72.22
     166           1        5.56            14        77.78
     167           1        5.56            15        83.33
     170           1        5.56            16        88.89
     175           1        5.56            17        94.44
     176           1        5.56            18       100.00
                     PROC FREQ:  Example 2                    44
     1-way tables for variables specified by TABLES keyword
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                                    Cumulative    Cumulative
    sex    Frequency     Percent     Frequency      Percent
    --------------------------------------------------------
    F             7       38.89             7        38.89
    M            11       61.11            18       100.00


                                    Cumulative    Cumulative
    age    Frequency     Percent     Frequency      Percent
    --------------------------------------------------------
     23           1        5.88             1         5.88
     26           1        5.88             2        11.76
     28           1        5.88             3        17.65
     29           1        5.88             4        23.53
     30           2       11.76             6        35.29
     31           1        5.88             7        41.18
     32           2       11.76             9        52.94
     33           1        5.88            10        58.82
     34           1        5.88            11        64.71
     36           1        5.88            12        70.59
     39           1        5.88            13        76.47
     41           1        5.88            14        82.35
     42           1        5.88            15        88.24
     47           1        5.88            16        94.12
     53           1        5.88            17       100.00

                     Frequency Missing = 1
                     PROC FREQ:  Example 3                    45
     2-way table using the CHISQ, WHERE, and OUT= keywords
                    Subsetting ages 0 to 29
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                      Table of sex by age

     sex       age

     Frequency|
     Percent  |
     Row Pct  |
     Col Pct  |      23|      26|      28|      29|  Total
     ---------+--------+--------+--------+--------+
     F        |      1 |      1 |      1 |      0 |      3
              |  25.00 |  25.00 |  25.00 |   0.00 |  75.00
              |  33.33 |  33.33 |  33.33 |   0.00 |
              | 100.00 | 100.00 | 100.00 |   0.00 |
     ---------+--------+--------+--------+--------+
     M        |      0 |      0 |      0 |      1 |      1
              |   0.00 |   0.00 |   0.00 |  25.00 |  25.00
              |   0.00 |   0.00 |   0.00 | 100.00 |
              |   0.00 |   0.00 |   0.00 | 100.00 |
     ---------+--------+--------+--------+--------+
     Total           1        1        1        1        4
                 25.00    25.00    25.00    25.00   100.00


               Statistics for Table of sex by age

     Statistic                     DF       Value      Prob
     ------------------------------------------------------
     Chi-Square                     3      4.0000    0.2615
     Likelihood Ratio Chi-Square    3      4.4987    0.2124
     Mantel-Haenszel Chi-Square     1      1.1905    0.2752
     Phi Coefficient                       1.0000
     Contingency Coefficient               0.7071
     Cramer's V                            1.0000

     WARNING: 100% of the cells have expected counts less
              than 5. Chi-Square may not be a valid test.

                        Sample Size = 4
                     PROC FREQ:  Example 3                    46
     2-way table using the CHISQ, WHERE, and OUT= keywords
                    Subsetting ages 0 to 29
                 A PRINT of the OUTPUT data set
                                  09:34 Tuesday, August 17, 1999

             Obs    sex    age    COUNT    PERCENT

              1      F      23      1         25
              2      F      26      1         25
              3      F      28      1         25
              4      M      29      1         25
                     PROC FREQ:  Example 4                    47
           2-way table using LIST and MISSING options
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                                       Cumulative    Cumulative
sex    age    Frequency     Percent     Frequency      Percent
---------------------------------------------------------------
F       23           1        5.56             1         5.56
F       26           1        5.56             2        11.11
F       28           1        5.56             3        16.67
F       30           1        5.56             4        22.22
F       31           1        5.56             5        27.78
F       33           1        5.56             6        33.33
F       47           1        5.56             7        38.89
M        .           1        5.56             8        44.44
M       29           1        5.56             9        50.00
M       30           1        5.56            10        55.56
M       32           2       11.11            12        66.67
M       34           1        5.56            13        72.22
M       36           1        5.56            14        77.78
M       39           1        5.56            15        83.33
M       41           1        5.56            16        88.89
M       42           1        5.56            17        94.44
M       53           1        5.56            18       100.00
                     PROC FREQ:  Example 5                    48
      3-way table: height by weight, controlling for name
                                  09:34 Tuesday, August 17, 1999

                       The FREQ Procedure

                  Table 1 of height by weight
                   Controlling for name=Donna

              height     weight

              Frequency|
              Percent  |
              Row Pct  |
              Col Pct  |      98|     121|  Total
              ---------+--------+--------+
                    62 |      1 |      0 |      1
                       | 100.00 |   0.00 | 100.00
                       | 100.00 |   0.00 |
                       | 100.00 |      . |
              ---------+--------+--------+
                    64 |      0 |      0 |      0
                       |   0.00 |   0.00 |   0.00
                       |      . |      . |
                       |   0.00 |      . |
              ---------+--------+--------+
              Total           1        0        1
                         100.00     0.00   100.00


                  Table 2 of height by weight
                   Controlling for name=Helen

              height     weight

              Frequency|
              Percent  |
              Row Pct  |
              Col Pct  |      98|     121|  Total
              ---------+--------+--------+
                    62 |      0 |      0 |      0
                       |   0.00 |   0.00 |   0.00
                       |      . |      . |
                       |      . |   0.00 |
              ---------+--------+--------+
                    64 |      0 |      1 |      1
                       |   0.00 | 100.00 | 100.00
                       |   0.00 | 100.00 |
                       |      . | 100.00 |
              ---------+--------+--------+
              Total           0        1        1
                           0.00   100.00   100.00

Contact: Charles Burchill       Telephone: (204) 789-3429
Manitoba Centre for Health Policy
Department of Community Health Sciences, University of Manitoba
4th floor Brodie Centre
408 - 727 McDermot Avenue
Winnipeg, Manitoba R3E 3P5       Fax: (204) 789-3910
Last modified on Wednesday, 24-Aug-2005 13:53:56 CDT