/* Data and SAS code for AL */ DATA ALWINS; INPUT TEAM $ WINS BATAVG DIVISION $; CARDS; NY 87 .277 East Tor 83 .275 East Balt 74 .272 East Bos 85 .267 East TB 69 .257 East Clev 90 .288 Central Det 79 .275 Central Chic 95 .286 Central KC 77 .288 Central Minn 69 .270 Central Ana 82 .280 West Tex 71 .283 West Sea 91 .269 West Oak 91 .270 West ; PROC SORT data=alwins OUT=ALBYDIV; BY DIVISION; run; PROC MEANS DATA=ALBYDIV; *PROC MEANS DATA=ALBYDIV MEAN RANGE VAR Q1 MEDIAN Q3; BY DIVISION; VAR WINS BATAVG; title 'Summary of Baseball Data Separated by Division'; RUN; /* Writing the summary statistics to another data file */ proc means data=alwins noprint; VAR WINS BATAVG; OUTPUT OUT = sm_stats; run; *proc means data=albydiv noprint; *BY DIVISION; *VAR WINS BATAVG; *OUTPUT OUT = sm_stats SUM(WINS BATAVG) = totwins totbat; /* The above takes the sum of WINS and the sum of BATAVG: The latter is not really a meaningful quantity...*/ run; proc print data=sm_stats; title 'Summary Statistics for Baseball League'; run;