Previous Page | Next Page

Working with Numeric Variables

Input SAS Data Set for Examples

Tradewinds Travel Inc. has an external file that contains information about their most popular tours:

1             2   3    4    5 
Japan         8  982 1020 Express
Greece       12   .   748 Express
New Zealand  16 1368 1539 Southsea
Ireland       7  787  628 Express
Venezuela     9  426  505 Mundial
Italy         8  852  598 Express
Russia       14 1106 1024 A-B-C
Switzerland   9  816  834 Tour2000
Australia    12 1299 1169 Southsea
Brazil        8  682  610 Almeida

The numbered fields represent

[1] the name of the country toured

[2] the number of nights on the tour

[3] the airfare in US dollars

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

[5] the name of the company that offers the tour

The following program creates a permanent SAS data set named MYLIB.POPULARTOURS:

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

data mylib.populartours;
   infile 'input-file';
   input Country $ 1-11 Nights AirCost LandCost Vendor $;
run;

proc print data=mylib.populartours;
   title 'Data Set MYLIB.POPULARTOURS';
run;

The following output shows the data set:

Data Set MYLIB.POPULARTOURS

                          Data Set MYLIB.POPULARTOURS                          1

                                             Air    Land
            Obs    Country        Nights    Cost    Cost    Vendor

              1    Japan             8       982    1020    Express 
              2    Greece           12         .     748    Express 
              3    New Zealand      16      1368    1539    Southsea
              4    Ireland           7       787     628    Express 
              5    Venezuela         9       426     505    Mundial 
              6    Italy             8       852     598    Express 
              7    Russia           14      1106    1024    A-B-C   
              8    Switzerland       9       816     834    Tour2000
              9    Australia        12      1299    1169    Southsea
             10    Brazil            8       682     610    Almeida 

In MYLIB.POPULARTOURS, the variables Nights, AirCost, and LandCost contain numbers and are stored as numeric variables. For comparison, variables Country and Vendor contain alphabetic and special characters as well as numbers; they are stored as character variables.

Previous Page | Next Page | Top of Page