Chapter Contents

Previous

Next
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 exist.


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.;
   title 'Meals Served in Company Cafeteria';
   title2 'Mean Number by Business Day';
run;


Output

Summary Calendar with MEAN Values by Observation
[HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.