Previous Page | Next Page

The CALENDAR Procedure

Example 7: Summary Calendar with MEAN Values By Observation


Procedure features:

CALID statement:

_CAL_ variable

OUTPUT=SEPARATE option

FORMAT statement

LABEL statement

MEAN statement

SUM statement

Other features:

PROC FORMAT:

PICTURE statement


This example


MEAN Values by Number of Days

To produce MEAN values based on the number of days in the calendar month, use MEANTYPE=NDAYS. By default, MEANTYPE=NOBS, which calculates the MEAN values according to the number of days for which data exists.


Program

 Note about code
data meals;
   input date : date7. Brkfst Lunch Dinner;
   datalines;
02Dec96       123 234 238
03Dec96       188 188 198
04Dec96       123 183 176
05Dec96       200 267 243
06Dec96       176 165 177
09Dec96       178 198 187
10Dec96       165 176 187
11Dec96       187 176 231
12Dec96       176 187 222
13Dec96       187 187 123
16Dec96       176 165 177
17Dec96       156   . 167
18Dec96       198 143 167
19Dec96       178 198 187
20Dec96       165 176 187
23Dec96       187 187 123
;
 Note about code
data closed;
   input date date. holiday $ 11-25;
   datalines;
26DEC96   Repairs
27DEC96   Repairs
30DEC96   Repairs
31DEC96   Repairs
24DEC96   Christmas Eve
25DEC96   Christmas
;
 Note about code
proc sort data=meals;
   by date;
run;
 Note about code
proc format;
   picture bfmt other = '000 Brkfst';
   picture lfmt other = '000 Lunch ';
   picture dfmt other = '000 Dinner';
run;
 Note about code
options nodate pageno=1 linesize=132 pagesize=60;
 Note about code
proc calendar data=meals holidata=closed;
   start date;
 Note about code
   holistart date;
   holiname holiday;
 Note about code
   sum brkfst lunch dinner / format=4.0;
   mean brkfst lunch dinner / format=6.2;
   label brkfst = 'Breakfasts Served'
         lunch  = '   Lunches Served'
         dinner = '   Dinners Served';
   format brkfst bfmt.
          lunch lfmt.
          dinner dfmt.;
 Note about code
   title 'Meals Served in Company Cafeteria';
   title2 'Mean Number by Business Day';
run;

Output: Listing

Summary Calendar with MEAN Values by Observation

                                                 Meals Served in Company Cafeteria                                                 1
                                                    Mean Number by Business Day

                    --------------------------------------------------------------------------------------------
                    |                                                                                          |
                    |                                      December  1996                                      |
                    |                                                                                          |
                    |------------------------------------------------------------------------------------------|
                    |   Sunday   |   Monday   |  Tuesday   | Wednesday  |  Thursday  |   Friday   |  Saturday  |
                    |------------+------------+------------+------------+------------+------------+------------|
                    |      1     |      2     |      3     |      4     |      5     |      6     |      7     |
                    |            |            |            |            |            |            |            |
                    |            | 123 Brkfst | 188 Brkfst | 123 Brkfst | 200 Brkfst | 176 Brkfst |            |
                    |            | 234 Lunch  | 188 Lunch  | 183 Lunch  | 267 Lunch  | 165 Lunch  |            |
                    |            | 238 Dinner | 198 Dinner | 176 Dinner | 243 Dinner | 177 Dinner |            |
                    |------------+------------+------------+------------+------------+------------+------------|
                    |      8     |      9     |     10     |     11     |     12     |     13     |     14     |
                    |            |            |            |            |            |            |            |
                    |            | 178 Brkfst | 165 Brkfst | 187 Brkfst | 176 Brkfst | 187 Brkfst |            |
                    |            | 198 Lunch  | 176 Lunch  | 176 Lunch  | 187 Lunch  | 187 Lunch  |            |
                    |            | 187 Dinner | 187 Dinner | 231 Dinner | 222 Dinner | 123 Dinner |            |
                    |------------+------------+------------+------------+------------+------------+------------|
                    |     15     |     16     |     17     |     18     |     19     |     20     |     21     |
                    |            |            |            |            |            |            |            |
                    |            | 176 Brkfst | 156 Brkfst | 198 Brkfst | 178 Brkfst | 165 Brkfst |            |
                    |            | 165 Lunch  |          . | 143 Lunch  | 198 Lunch  | 176 Lunch  |            |
                    |            | 177 Dinner | 167 Dinner | 167 Dinner | 187 Dinner | 187 Dinner |            |
                    |------------+------------+------------+------------+------------+------------+------------|
                    |     22     |     23     |     24     |     25     |     26     |     27     |     28     |
                    |            |            |Christmas Ev|*Christmas**|**Repairs***|**Repairs***|            |
                    |            | 187 Brkfst |            |            |            |            |            |
                    |            | 187 Lunch  |            |            |            |            |            |
                    |            | 123 Dinner |            |            |            |            |            |
                    |------------+------------+------------+------------+------------+------------+------------|
                    |     29     |     30     |     31     |            |            |            |            |
                    |            |**Repairs***|**Repairs***|            |            |            |            |
                    |            |            |            |            |            |            |            |
                    |            |            |            |            |            |            |            |
                    |            |            |            |            |            |            |            |
                    --------------------------------------------------------------------------------------------

                                               -------------------------------------
                                               |                   | Sum  |  Mean  |
                                               |                   |      |        |
                                               | Breakfasts Served | 2763 | 172.69 |
                                               |    Lunches Served | 2830 | 188.67 |
                                               |    Dinners Served | 2990 | 186.88 |
                                               -------------------------------------

Previous Page | Next Page | Top of Page