O'Reilly logo

Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Prerequisites
You should understand the concepts presented in all previous sections before proceeding
with this section.
Input SAS Data Set for Examples
Tradewinds Travel offers tours to art museums and galleries in various cities. The
company decided that in order to make its process more efficient, additional information
is needed. For example, if the tour covers too many museums and galleries within a time
period, then the number of museums visited must be decreased or the number of days for
the tour needs to change. If the guide who is assigned to the tour is not available, then
another guide must be assigned. Most of the process involves selecting observations that
meet or that do not meet various criteria and then taking the required action.
The Tradewinds Travel tour data is stored in an external file that contains the following
information:
1 2 3 4 5 6 7
------------------------------------------------------
Rome 3 1550 7 4 M, 3 G D'Amico Torres
Brasilia 8 3360 6 5 M, 1 other Lucas Lucas
London 6 2460 5 3 M, 2 G Wilson Lucas
Warsaw 6 . 8 5 M, 1 G, 2 other Lucas D'Amico
Madrid 3 740 5 3 M, 2 other Torres D'Amico
Amsterdam 4 1160 6 3 M, 3 G Vandever
The following list explains the numbered items in the preceding file:
1
identifies the name of the destination city
2
specifies the number of nights in the city
3
specifies the cost of the land package in U.S. dollars
4
specifies the number of events the trip offers (such as visits to museums and
galleries)
5
provides a brief description of events. M indicates a museum, G indicates a gallery,
and
other indicates another type of event
6
provides the name of the tour guide
7
provides the name of the backup tour guide
The following DATA step creates MYLIB.ARTTOURS:
libname mylib 'SAS-library';
data mylib.arttours;
infile 'input-file' truncover;
input City $ 1-9 Nights 11 LandCost 13-16 NumberOfEvents 18
EventDescription $ 20-36 TourGuide $ 38-45
BackUpGuide $ 47-54;
run;
148 Chapter 10 Acting on Selected Observations

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required