SAS Examples: Proc Univariate

Last updated:
Table of Contents

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

Download the source file here

Sample data

data mytable;
    length name $20.;
    input id name $ balance; 

DATALINES;
1 alice   5.12  
2 bob  12.31
3 charlie 45.14
4 daniel 32.78
4 ella 20.23
5 fay 70.89
6 gabe 29.67
7 henry 55.66
8 ivan .
;
run;
ID NAME BALANCE
1 alice 5.12
2 bob 12.31
3 charlie 45.14
4 daniel 32.78
4 ella 20.23
5 fay 70.89
6 gabe 29.67
7 henry 55.66
8 ivan .

Simplest possible example

proc univariate data=mytable;
    var balance;
run;

Histogram output

proc univariate data=mytable;
    var balance;
    histogram balance  / vaxis=0 to 100 by 10 midpoints=0 to 100 by 10;
run;

Simple-proc-univariate-histogram Note that missing values are not shown

Histogram with grid lines

proc univariate data=mytable;
    var balance;
    histogram balance  / vaxis=0 to 100 by 10 midpoints=0 to 100 by 10 cgrid=black;
run;

sas-univariate-histogram-gridlines To add gridlines use the cgrid option to the histogram statement.


References

Dialogue & Discussion