SAS Tip
of the Month Here is an oldie, but a good example of SAS code that I find useful. Using the following data find the Number of Observations, Mean, Standard Deviation, Median, Minimum and Maximum values for the following data, grouping by Gender and age groups 1864 and 6575: ** DATA ** SUBJECT AGE GENDER 001 35 M 002 70 M 003 65 M 004 40 F 005 66 F 006 36 F ** SAS PROGRAM ** PROC FORMAT; VALUE agex 1864='1864' 6575='6575' other='Unexpected'; RUN; PROC MEANS DATA=demog N MEAN STD MEDIAN MIN MAX; CLASS gender age; VAR age; FORMAT age agex.; RUN; Using the AGE variable both in the CLASS and VAR statements it is treated both as a category and analysis variable. Note that the median calculation came into the MEANS procedure in SAS version 7  prior to that the median could be calculated using the UNIVARIATE procedure. 

________________________________ Updated November 13, 2003 