Input SAS Data Sets for Examples

The following program creates two SAS data sets, SOUTHAMERICAN and EUROPEAN. Each data set contains the following variables:
Year
is the year in which South American and European countries competed in the World Cup Finals from 1954 to 1998.
Country
is the name of the competing country.
Score
is the final score of the game.
Result
is the result of the game. The value for winners is won; the value for losers is lost.
The PROC SORT statements in the example below sort the data sets in ascending order according to the BY variable. To create the interleaved data set in the next example, the data must be in ascending order.
data southamerican;
   title 'South American World Cup Finalists from 1954 to 1998';
   input  Year $  Country $ 9-23 Score $ 25-28 Result $ 32-36;
   datalines;
1998    Brazil          0-3    lost
1994    Brazil          3-2    won
1990    Argentina       0-1    lost
1986    Argentina       3-2    won
1978    Argentina       3-1    won 
1970    Brazil          4-1    won
1962    Brazil          3-1    won
1958    Brazil          5-2    won
;

data european;
   title 'European World Cup Finalists From 1954 to 1998';
   input  Year $  Country $ 9-23 Score $ 25-28 Result $ 32-36;
   datalines;
1998    France          3-0    won
1994    Italy           2-3    lost
1990    West Germany    1-0    won
1986    West Germany    2-3    lost
1982    Italy           3-1    won
1982    West Germany    1-3    lost
1978    Netherlands     1-3    lost
1974    West Germany    2-1    won
1974    Netherlands     1-2    lost
1970    Italy           1-4    lost
1966    England         4-2    won
1966    West Germany    2-4    lost
1962    Czechoslovakia  1-3    lost
1958    Sweden          2-5    lost
1954    West Germany    3-2    won
1954    Hungary         2-3    lost
;
run;

proc sort data=southamerican;
   by year;

proc print data=southamerican;
   title 'World Cup Finalists:';
   title2 'South American Countries';
   title3 'from 1954 to 1998';
run;

proc sort data=european;
   by year;
run;

proc print data=european;
   title 'World Cup Finalists:';
   title2 'European Countries';
   title3 'from 1954 to 1998';
run;
The PROC SORT statement sorts the data set in ascending order according to the BY variable. To create the interleaved data set in the next example, the data must be in ascending order.
The following output displays the SOUTHAMERICAN data set:
Display 22.1 World Cup Finalists by Continent: South America
World Cup Finalists by Continent: South America
The following output displays the EUROPEAN data set:
Display 22.2 World Cup Finalists by Continent: Europe
World Cup Finalists by Continent: Europe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.205.189