Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The ASSIGN Procedure

Example 2.4: Using PROC ASSIGN with a BY Statement

A major beverage company wants to assign TV commercials to television commercial time slot openings in a way that maximizes the overall effectiveness of its television advertising. The time slots in this example begin at 7:00 on a Saturday morning and run hourly through 3:00 p.m. A combination of Nielsen TV ratings and market research testing produces an effectiveness rating for each time slot and commercial combination. The commercials are of three types: children, lifestyle, and sports. The company is willing to show up to three commercials in each time slot as long as the commercials are of different types. Which commercials should be assigned to which time slots in order to maximize the total effectiveness of its television advertising campaign? Data are missing for those time slots where certain programs are not available; for instance, no sports shows are presented during the 7:00 a.m. time slot.

The following statements produce Output 2.4.1:

   title 'Assigning Televison Commercials Using the BY Statement';

   data beverage;
      input commercl $ type $ slot1-slot9;
      datalines;
COMM1 KIDS 27.2 32.8 30.4 31.5 20.9 19.8   .    .    .
COMM2 KIDS 37.4 33.5 38.4 32.4 25.6 27.2   .    .    .
COMM3 KIDS 32.5 31.9 34.6 34.5 26.7 28.3   .    .    .
COMM4 LIFEST .  22.6 25.9 25.3 26.4 28.3 29.1 22.2 20.2
COMM5 LIFEST .  25.1 36.6 36.8 38.2 33.5 33.2 33.1 30.1
COMM6 LIFEST .  20.2 31.3 29.3 24.6 25.1 20.0 22.4 23.1
COMM7 SPORTS .    .  25.1 26.1 28.3 36.1 29.4 31.7 34.5
COMM8 SPORTS .    .  24.7 27.2 36.4 31.2 28.7 33.2 33.1
COMM9 SPORTS .  20.2 20.4 20.2 25.6 37.8 35.6 32.4 34.3
  ;
  proc assign maximum out=newslots;
     cost slot1-slot9;
     id commercl;
     by type;
  run;
  proc print;
     by type;
     sum _fcost_;
  run;

Output 2.4.1: Assigning Television Commercials using the BY Statement

Assigning Televison Commercials Using the BY Statement

type=KIDS

Obs commercl slot1 slot2 slot3 slot4 slot5 slot6 slot7 slot8 slot9 _ASSIGN_ _FCOST_
1 COMM1 27.2 32.8 30.4 31.5 20.9 19.8 . . . slot2 32.8
2 COMM2 37.4 33.5 38.4 32.4 25.6 27.2 . . . slot3 38.4
3 COMM3 32.5 31.9 34.6 34.5 26.7 28.3 . . . slot4 34.5
type                       105.7

type=LIFEST

Obs commercl slot1 slot2 slot3 slot4 slot5 slot6 slot7 slot8 slot9 _ASSIGN_ _FCOST_
4 COMM4 . 22.6 25.9 25.3 26.4 28.3 29.1 22.2 20.2 slot7 29.1
5 COMM5 . 25.1 36.6 36.8 38.2 33.5 33.2 33.1 30.1 slot5 38.2
6 COMM6 . 20.2 31.3 29.3 24.6 25.1 20.0 22.4 23.1 slot3 31.3
type                       98.6

type=SPORTS

Obs commercl slot1 slot2 slot3 slot4 slot5 slot6 slot7 slot8 slot9 _ASSIGN_ _FCOST_
7 COMM7 . . 25.1 26.1 28.3 36.1 29.4 31.7 34.5 slot9 34.5
8 COMM8 . . 24.7 27.2 36.4 31.2 28.7 33.2 33.1 slot5 36.4
9 COMM9 . 20.2 20.4 20.2 25.6 37.8 35.6 32.4 34.3 slot6 37.8
type                       108.7
                        313.0


On the basis of this survey, this company has decided to drop commercial advertising from the 7:00 a.m. (slot1) and 2:00 p.m. (slot8) time slots.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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