Basic SAS Utilities

Overview

In analyzing data you often need to print the contents (or selected portions) of your data. In addition, certain statistical procedures require that a dataset be sorted. This page will cover how to do this through selected SAS procedures.

SAS Procedure Print

The print procedure will print a dataset. To print a dataset named test you would do the following:

proc print data=test;
title 'Some Title';
run;

To print only selected variables you can add the var keyword to specify the variables to print. Below is an example that does this:

proc print data=test;
title 'Some Title';
var age income; run;

SAS Procedure Sort

The sort procedure will sort a dataset. In order to sort a dataset you must specify a variable by which to sort the dataset. Below is an example that does this:

proc sort data=test;
by age;
run;

If you want to sort by two variables you can specify multiple variables.

SAS Procedure Contents

The contents procedure prints the variables associated with a dataset. Below is an example that does this:

proc contents data=test;
run;


Author - Jack Suess
UMBC University Computing Services
Created - 1/15/96