Previous Page | Next Page

Using More Than One Observation in a Calculation

Input File and SAS Data Set for Examples

Tradewinds Travel needs to know how much business the company did with various tour vendors during the peak season. The data that the company wants to look at is the total number of people that are scheduled on tours with various vendors, and the total value of the tours that are scheduled.

The following external file contains data about Tradewinds Travel tours:

1             2    3       4 
France       575 Express  10
Spain        510 World    12
Brazil       540 World     6
India        489 Express   .
Japan        720 Express  10
Greece       698 Express  20
New Zealand 1489 Southsea  6
Venezuela    425 World     8
Italy        468 Express   9
USSR         924 World     6
Switzerland  734 World    20
Australia   1079 Southsea 10
Ireland      558 Express   9

The numbered fields represent

[1] the destination country for the tour

[2] the cost of the land package in US dollars

[3] the name of the vendor

[4] the number of people that were scheduled on that tour

The first step is to create a permanent SAS data set. The following program creates the data set MYLIB.TOURREVENUE:

options pagesize=60 linesize=80 pageno=1 nodate;
libname mylib 'permanent-data-library';

data mylib.tourrevenue;
   infile 'input-file' truncover;
   input Country $ 1-11 LandCost Vendor $ NumberOfBookings;
run;

proc print data=mylib.tourrevenue;
   title 'SAS Data Set MYLIB.TOURREVENUE';
run;

The PROC PRINT statement that follows the DATA step produces this display of the MYLIB.TOURREVENUE data set:

Data Set MYLIB.TOURREVENUE

                         SAS Data Set MYLIB.TOURREVENUE                        1

                                                          Number
                                     Land                   Of
               Obs    Country        Cost    Vendor      Bookings

                 1    France          575    Express        10   
                 2    Spain           510    World          12   
                 3    Brazil          540    World           6   
                 4    India           489    Express         .   
                 5    Japan           720    Express        10   
                 6    Greece          698    Express        20   
                 7    New Zealand    1489    Southsea        6   
                 8    Venezuela       425    World           8   
                 9    Italy           468    Express         9   
                10    USSR            924    World           6   
                11    Switzerland     734    World          20   
                12    Australia      1079    Southsea       10   
                13    Ireland         558    Express         9   

Each observation in the data set MYLIB.TOURREVENUE contains the cost of a tour and the number of people who scheduled that tour. The tasks of Tradewinds Travel are as follows:

Previous Page | Next Page | Top of Page