Frequency and Mean

proc print data=sashelp.class;

where age > 13;

run;

data temp;

set sashelp.cars;

run;

filteration */

proc print data=temp;

where type=’SUV’;

run;

data limit */

proc print data=sashelp.cars(obs=10);

run;

frequency proc */

proc freq data = sashelp.cars;

tables type/nocum nopercent;

run;

proc freq data = sashelp.cars;

tables make type;

run;

if we don’t need cumulative and precent */

proc freq data = sashelp.cars;

tables type / nocum nofreq;

run;

data temp;

set sashelp.cars;

run;

cross tabulation – frequency of one variable w.r.t another */

proc freq data = temp;

tables make * type;

run;

proc freq data = temp;

tables make * type / norow nocol nopercent;

run;

cross tabulation of make w.r.t type and origin*/

proc freq data = temp;

tables make * (type origin);

run;

 sum of observations/numbers of values */

data temp;

set sashelp.cars;

run;

  In the DATA= option, you need to specify the dataset you want to use. In the VAR= option, you need to refer the numeric variables you want to analyze.  */

  You cannot refer character variables in the VAR statement. */

average = sum of observatiions/number of observations

  mean function we use to calculate row vise data */

data temp2(keep=msrp invoice avg_value);

set temp;

avg_value=mean(msrp,invoice);

run;

proc means data = sashelp.class nmiss n sum mean;

var height;

run;

  if you want to see number of non-missing values and number of missing values. */

Proc Means Data = temp;

Var height ;

Run;

Statistical Option                               Description */

  N                                                           Number of observations */

  NMISS                                                 Number of missing observations */

  MEAN                                                  Arithmetic average */

  STD                                                      Standard Deviation */

  MIN                                                     Minimum */

  MAX                                                    Maximum */

  SUM                                                    Sum of observations */

  MEDIAN                                             50th percentile */

  P1                                                         1st percentile */

  P5                                                         5th percentile */

  P10                                                      10th percentile */

  P90                                                      90th percentile */

  P95                                                      95th percentile */

  P99                                                      99th percentile */

  Q1                                                        First Quartile */

  Q3                                                        Third Quartile */

  VAR                                                      Variance */

  RANGE                                                Range */

  USS                                                      Uncorr. sum of squares */

  CSS                                                       Corr. sum of squares */

  STDERR                                               Standard Error */

  T                                                           Student’s t value for testing Ho: md = 0 */

  PRT                                                      P-value associated with t-test above */

  SUMWGT                                           Sum of the WEIGHT variable values */

  QRANGE                                             Quartile range */