Sample 25341: Creating summaries and schedules with PROC CALENDAR
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample is from the SAS Sample Library. For additional information refer to SAS Help and Online Documentation.
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: Calendar */
/* TITLE: Creating Summaries and Schedules with PROC CALENDAR*/
/* PRODUCT: SAS */
/* SYSTEM: ALL */
/* KEYS: SCHEDULE SUMMARY */
/* PROCS: CALENDAR FORMAT */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: */
/****************************************************************/
/* The following data set represents monthly ticket sales */
/* for a small commuter airline. PROC CALENDAR is used in */
/* summary format to show first class and coach ticket sales */
/* for the month of December. */
options ls=78 ps=60 nodate;
data;
input date:date. first coach;
list;
cards;
1dec87 12 90
2dec87 13 80
3dec87 12 75
4dec87 14 108
5dec87 10 60
6dec87 14 102
7dec87 13 84
8dec87 14 76
9dec87 13 73
10dec87 11 62
11dec87 14 100
12dec87 13 80
13dec87 14 105
14dec87 11 78
15dec87 12 80
16dec87 9 72
17dec87 12 104
18dec87 14 106
19dec87 12 103
20dec87 14 102
20dec87 14 122
21dec87 14 120
22dec87 16 134
23dec87 16 134
24dec87 16 134
25dec87 12 80
26dec87 12 98
27dec87 14 110
28dec87 16 122
29dec87 16 134
30dec87 16 134
31dec87 16 134
;
run;
proc format;
picture ffmt other='009 first';
picture cfmt other='009 coach';
picture mfmt other=' 0009';
run;
title1 'proc calendar header=small;';
title2 '(small header, no legend)';
title4 'Ticket Sales Summary';
proc calendar header=small;
id date;
run;
title1 'proc calendar legend;';
title2 '(default header, legend with sums)';
title4 'Ticket Sales Summary';
proc calendar legend;
id date;
sum first coach;
run;
title1 'proc calendar header=large legend; format...;';
title2 '(large header, legend with sums & means, values formatted)';
title4 'Ticket Sales Summary';
proc calendar header=large legend;
id date;
format first ffmt.;
format coach cfmt.;
sum first coach / format=mfmt.;
mean first coach / format=mfmt.;
run;
/* The following data sets contain the monthly schedule for */
/* a departmental organization. PROC CALENDAR is used to show */
/* events and holidays on the appropriate dates. */
data hol;
input hdate datetime13. hevent $ 16-34;
list;
cards;
24dec87:00:00 Vacation
25dec87:00:00 Christmas
;
run;
data;
input date:date. event $ 10-34 duration;
list;
cards;
1dec87 Dept Meeting 1
7dec87 District Meeting 3
28dec87 Inventory 4
;
run;
title1 'proc calendar;';
title2 '(no holidays, weekends)';
title4 'Departmental Schedule';
proc calendar;
id date;
dur duration;
run;
title1 'proc calendar holidata=hol formchar=''|-+-+|+|+-+@@|-/\<> '';';
title2 '(holidays and weekends, new formchars)';
title4 'Departmental Schedule';
proc calendar holidata=hol formchar='|-+-+|+|+-+@@|-/\<> ';
id date;
dur duration;
holidays hdate;
holiname hevent;
run;
title1 'proc calendar holidata=hol weekdays;';
title2 '(holidays, no weekends, default formchars)';
title4 'Departmental Schedule';
proc calendar holidata=hol weekdays;
id date;
dur duration;
holidays hdate;
holiname hevent;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
proc calendar header=small;
(small header, no legend)
Ticket Sales Summary
December 1987
------------------------------------------------------------------------------
| Sunday | Monday | Tuesday |Wednesday | Thursday | Friday | Saturday |
|----------+----------+----------+----------+----------+----------+----------|
| | | 1 | 2 | 3 | 4 | 5 |
| | | | | | | |
| | | 12 | 13 | 12 | 14 | 10 |
| | | 90 | 80 | 75 | 108 | 60 |
|----------+----------+----------+----------+----------+----------+----------|
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| | | | | | | |
| 14 | 13 | 14 | 13 | 11 | 14 | 13 |
| 102 | 84 | 76 | 73 | 62 | 100 | 80 |
|----------+----------+----------+----------+----------+----------+----------|
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| | | | | | | |
| 14 | 11 | 12 | 9 | 12 | 14 | 12 |
| 105 | 78 | 80 | 72 | 104 | 106 | 103 |
|----------+----------+----------+----------+----------+----------+----------|
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| | | | | | | |
| 14 | 14 | 16 | 16 | 16 | 12 | 12 |
| 122 | 120 | 134 | 134 | 134 | 80 | 98 |
|----------+----------+----------+----------+----------+----------+----------|
| 27 | 28 | 29 | 30 | 31 | | |
| | | | | | | |
| 14 | 16 | 16 | 16 | 16 | | |
| 110 | 122 | 134 | 134 | 134 | | |
------------------------------------------------------------------------------
proc calendar legend;
(default header, legend with sums)
Ticket Sales Summary
------------------------------------------------------------------------------
| |
| December 1987 |
| |
|----------------------------------------------------------------------------|
| Sunday | Monday | Tuesday |Wednesday | Thursday | Friday | Saturday |
|----------+----------+----------+----------+----------+----------+----------|
| | | 1 | 2 | 3 | 4 | 5 |
| | | | | | | |
| | | 12 | 13 | 12 | 14 | 10 |
| | | 90 | 80 | 75 | 108 | 60 |
|----------+----------+----------+----------+----------+----------+----------|
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| | | | | | | |
| 14 | 13 | 14 | 13 | 11 | 14 | 13 |
| 102 | 84 | 76 | 73 | 62 | 100 | 80 |
|----------+----------+----------+----------+----------+----------+----------|
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| | | | | | | |
| 14 | 11 | 12 | 9 | 12 | 14 | 12 |
| 105 | 78 | 80 | 72 | 104 | 106 | 103 |
|----------+----------+----------+----------+----------+----------+----------|
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| | | | | | | |
| 14 | 14 | 16 | 16 | 16 | 12 | 12 |
| 122 | 120 | 134 | 134 | 134 | 80 | 98 |
|----------+----------+----------+----------+----------+----------+----------|
| 27 | 28 | 29 | 30 | 31 | | |
| | | | | | | |
| 14 | 16 | 16 | 16 | 16 | | |
| 110 | 122 | 134 | 134 | 134 | | |
------------------------------------------------------------------------------
----------------------------
| Legend | Sum |
| | |
| first | 415 |
| coach | 3094 |
----------------------------
proc calendar header=large legend; format...;
(large header, legend with sums & means, values formatted)
Ticket Sales Summary
**** ***** *** ***** * * **** ***** ****
* * * * * * ** ** * * * * *
* * * * * * * * * * * * *
* * **** * **** * * *** **** ****
* * * * * * * * * * * *
* * * * * * * * * * * * *
**** ***** *** ***** * * **** ***** * *
------------------------------------------------------------------------------
| Sunday | Monday | Tuesday |Wednesday | Thursday | Friday | Saturday |
|----------+----------+----------+----------+----------+----------+----------|
| | | 1 | 2 | 3 | 4 | 5 |
| | | | | | | |
| | | 12 first | 13 first | 12 first | 14 first | 10 first |
| | | 90 coach | 80 coach | 75 coach |108 coach | 60 coach |
|----------+----------+----------+----------+----------+----------+----------|
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| | | | | | | |
| 14 first | 13 first | 14 first | 13 first | 11 first | 14 first | 13 first |
|102 coach | 84 coach | 76 coach | 73 coach | 62 coach |100 coach | 80 coach |
|----------+----------+----------+----------+----------+----------+----------|
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| | | | | | | |
| 14 first | 11 first | 12 first | 9 first | 12 first | 14 first | 12 first |
|105 coach | 78 coach | 80 coach | 72 coach |104 coach |106 coach |103 coach |
|----------+----------+----------+----------+----------+----------+----------|
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| | | | | | | |
| 14 first | 14 first | 16 first | 16 first | 16 first | 12 first | 12 first |
|122 coach |120 coach |134 coach |134 coach |134 coach | 80 coach | 98 coach |
|----------+----------+----------+----------+----------+----------+----------|
| 27 | 28 | 29 | 30 | 31 | | |
| | | | | | | |
| 14 first | 16 first | 16 first | 16 first | 16 first | | |
|110 coach |122 coach |134 coach |134 coach |134 coach | | |
------------------------------------------------------------------------------
------------------------------
| Legend | Sum | Mean |
| | | |
| first | 415 | 13 |
| coach | 3094 | 99 |
------------------------------
proc calendar;
(no holidays, weekends)
Departmental Schedule
------------------------------------------------------------------------------
| |
| December 1987 |
| |
|----------------------------------------------------------------------------|
| Sunday | Monday | Tuesday |Wednesday | Thursday | Friday | Saturday |
|----------+----------+----------+----------+----------+----------+----------|
| | | 1 | 2 | 3 | 4 | 5 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | |+Dept Mee+| | | | |
|----------+----------+----------+----------+----------+----------+----------|
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| |+=======District Meeting=======+| | | |
|----------+----------+----------+----------+----------+----------+----------|
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
|----------+----------+----------+----------+----------+----------+----------|
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
|----------+----------+----------+----------+----------+----------+----------|
| 27 | 28 | 29 | 30 | 31 | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| |+================Inventory================+| | |
------------------------------------------------------------------------------
proc calendar holidata=hol formchar='|-+-+|+|+-+@@|-/\<> ';
(holidays and weekends, new formchars)
Departmental Schedule
+----------------------------------------------------------------------------+
| |
| December 1987 |
| |
|----------------------------------------------------------------------------|
| Sunday | Monday | Tuesday |Wednesday | Thursday | Friday | Saturday |
|----------+----------+----------+----------+----------+----------+----------|
| | | 1 | 2 | 3 | 4 | 5 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | |@Dept Mee@| | | | |
|----------+----------+----------+----------+----------+----------+----------|
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| |@@@@@@@@District Meeting@@@@@@@@| | | |
|----------+----------+----------+----------+----------+----------+----------|
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
|----------+----------+----------+----------+----------+----------+----------|
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| | | | | Vacation |Christmas | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
|----------+----------+----------+----------+----------+----------+----------|
| 27 | 28 | 29 | 30 | 31 | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| |@@@@@@@@@@@@@@@@@Inventory@@@@@@@@@@@@@@@@@| | |
+----------------------------------------------------------------------------+
proc calendar holidata=hol weekdays;
(holidays, no weekends, default formchars)
Departmental Schedule
----------------------------------------------------------------------------
| |
| December 1987 |
| |
|--------------------------------------------------------------------------|
| Monday | Tuesday | Wednesday | Thursday | Friday |
|--------------+--------------+--------------+--------------+--------------|
| | 1 | 2 | 3 | 4 |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| |+Dept Meeting+| | | |
|--------------+--------------+--------------+--------------+--------------|
| 7 | 8 | 9 | 10 | 11 |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
|+=============District Meeting=============+| | |
|--------------+--------------+--------------+--------------+--------------|
| 14 | 15 | 16 | 17 | 18 |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
|--------------+--------------+--------------+--------------+--------------|
| 21 | 22 | 23 | 24 | 25 |
| | | |***Vacation***|**Christmas***|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
|--------------+--------------+--------------+--------------+--------------|
| 28 | 29 | 30 | 31 | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
|+========================Inventory========================+| |
----------------------------------------------------------------------------
This example demonstrates how to create summaries and schedules with PROC CALENDAR.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> CALENDAR
|
Date Modified: | 2005-10-26 03:03:01 |
Date Created: | 2005-05-23 13:47:08 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |