Creating a Summarized Data Set Using PROC SUMMARY

You can also create a summarized output data set by using PROC SUMMARY. When you use PROC SUMMARY, you use the same code to produce the output data set that you would use with PROC MEANS.

The difference between the two procedures is that PROC MEANS produces a report by default (remember that you can use the NOPRINT option to suppress the default report). By contrast, to produce a report in PROC SUMMARY, you must include a PRINT option in the PROC SUMMARY statement.


Example

The following example creates an output data set but does not create a report:

     proc summary data=clinic.diabetes;
        var age height weight;
        class sex;
        output out=work.sum_gender
           mean=AvgAge AvgHeight AvgWeight;
     run; 
If you placed a PRINT option in the PROC SUMMARY statement above, this program would produce the same report as if you replaced the word SUMMARY with MEANS.
     proc summary data=clinic.diabetes print;
        var age height weight;
        class sex;
        output out=work.sum_gender
           mean=AvgAge AvgHeight AvgWeight;
     run; 

Sex N Obs Variable N Mean Std Dev Minimum Maximum
F 11 Age
Height
Weight
11
11
11
48.9090909
63.9090909
150.4545455
13.3075508
2.1191765
18.4464828
16.0000000
61.0000000
102.0000000
63.0000000
68.0000000
168.0000000
M 9 Age
Height
Weight
9
9
9
44.0000000
70.6666667
204.2222222
12.3895117
2.6457513
30.2893454
15.0000000
66.0000000
140.0000000
54.0000000
75.0000000
240.0000000