Page One

Campus Computing News

Welcome to the New Millennium!

UNT's General Access Labs

Did You Get Your EagleMail?

SAS Corner

Today's Cartoon

RSS Matters

The Network Connection

List of the Month

WWW@UNT.EDU

Short Courses

IRC News

Staff Activities

Subscribe to Benchmarks Online
    

Research and Statistical Support


This is a new Benchmarks Online monthly feature. -- Ed.

SAS Corner

By Dr.Karl Ho, Research and Statistical Support Services Manager

Although I've studied SAS for years, I never stop getting surprises from this big system. Every once in a while I find myself amazed by functions that I didn't even know existed. In this short piece, I will introduce a procedure that may be of interest to you if you need to be involved in human resources management. 

PROC CALENDAR procedure in SAS/BASE combines data from individual personal schedule with corporate schedule/events and print out calendars for individual workers. While scheduling applications abound, PROC CALENDAR serves more than just printing calendars. It also organizes calendars and schedules for a group or a company while keeping data for really easy retrieval.

To create a calendar, the programmer needs to prepare two SAS data sets: events data and holiday data. The following example illustrates putting holidays and events together on one calendar:

/* This example illustrates the use of PROC CALENDAR procedure */
/* It generates the calendar of all events scheduled using separate data sets */

options nodate pageno=1 linesize=110 pagesize=60;

/* Output Delivery System (ODS) statements converts the output to html */

ods html file="c:\temp\cal0.html";

/* Generating event data under the name ALLACTY */

data allacty;
   input date : date7. event $ 9-36 who $ 37-48 long;
   datalines;
01JUL96 Dist. Mtg.                  All          1
17JUL96 Bank Meeting                1st Natl     1
02JUL96 Mgrs. Meeting               District 6   2
11JUL96 Mgrs. Meeting               District 7   2
03JUL96 Interview                   JW           1
08JUL96 Sales Drive                 District 6   5
15JUL96 Sales Drive                 District 7   5
08JUL96 Trade Show                  Knox         3
22JUL96 Inventors Show              Melvin       3
11JUL96 Planning Council            Group II     1
18JUL96 Planning Council            Group III    1
25JUL96 Planning Council            Group IV     1
12JUL96 Seminar                     White        1
19JUL96 Seminar                     White        1
18JUL96 NewsLetter Deadline         All          1
05JUL96 VIP Banquet                 JW           1
19JUL96 Co. Picnic                  All          1
16JUL96 Dentist                     JW           1
24JUL96 Birthday                    Mary         1
25JUL96 Close Sale                  WYGIX Co.    2
;
 
/* Recording holiday data */

data hol;
   input date : date7. holiday $ 11-25 holilong @27;
   datalines;
05jul96   Vacation        3
04jul96   Independence    1
;

/* Sorting data by date before the PROC CALENDAR procedure */
 
proc sort data=allacty;
   by date;
run;
 
/* Create the schedule calendar. DATA= identifies the activities data set; */
/* HOLIDATA= identifies the holidays data set. */
/* WEEKDAYS specifies that a week consists of five eight-hour work days. */

proc calendar data=allacty holidata=hol;

/* The START statement specifies the variable in the activities data set that */
/* contains the starting date of the activities; */
/* DUR specifies the variable that contains the duration of each activity. */
/* Creating a schedule calendar requires START and DUR. */

      start date;
      dur long;

/* The HOLISTART, HOLIVAR, and HOLIDUR statements specify the variables in */
/* the holidays data set that contain the start date, name, */
/* and duration of each holiday, respectively. */
/* When you use a holidays data set, HOLISTART is required. */
/* Because at least one holiday lasts more than one day, HOLIDUR is required.  */

   holistart date;
   holivar holiday;
   holidur holilong;
   title1 'Summer Planning Calendar:  John Doe';
   title2 'President, Community Bank';
run;
ods html close;

The ODS statements convert the output into an HTML file CAL0.htm while the sample ASCII output is as follows:

                                     Summer Planning Calendar:  John Doe                                     1
                                          President, Community Bank

  ?-------------------------------------------------------------------------------------------------------?
  |                                                                                                        |
  |                                               July  1996                                               |
  |                                                                                                        |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?
  |    Sunday    |    Monday    |   Tuesday    |  Wednesday   |   Thursday   |    Friday    |   Saturday   |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?
  |              |       1      |       2      |       3      |       4      |       5      |       6      |
  |              |              |              |              |*Independence*|***Vacation***|***Vacation***|
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |+Interview/JW+|              |              |              |
  |              |+Dist. Mtg./A+|+=Mgrs. Meeting/District 6==+|              |              |              |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?
  |       7      |       8      |       9      |      10      |      11      |      12      |      13      |
  |***Vacation***|              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |+=============Trade Show/Knox==============+|+Planning Cou+|+Seminar/Whit+|              |
  |              |+=========================Sales Drive/District 6=========================+|              |
  |              |+VIP Banquet/+|              |              |+=Mgrs. Meeting/District 7==+|              |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?
  |      14      |      15      |      16      |      17      |      18      |      19      |      20      |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |              |+NewsLetter D+|+Co. Picnic/A+|              |
  |              |              |+=Dentist/JW=+|+Bank Meeting+|+Planning Cou+|+Seminar/Whit+|              |
  |              |+=========================Sales Drive/District 7=========================+|              |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?
  |      21      |      22      |      23      |      24      |      25      |      26      |      27      |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |+Birthday/Mar+|+===Close Sale/WYGIX Co.====+|              |
  |              |+==========Inventors Show/Melvin===========+|+Planning Cou+|              |              |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?
  |      28      |      29      |      30      |      31      |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  |              |              |              |              |              |              |              |
  ?-------------?-------------?-------------?-------------?-------------?-------------?-------------?