Using More Than One Observation in a Calculation |
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 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:
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:
to determine how much money was spent with each vendor and with all vendors together
to store the totals in a SAS data set that is separate from the individual vendors' records
to find the tour that produced the most revenue, which is determined by the land cost times the number of people who scheduled the tour
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.