• Ekta Aggarwal

PROC CONTENTS in SAS

PROC CONTENTS is a highly useful procedure which provides summary information about our dataset like:

  • Last modified and dataset creation information

  • Number of observations (rows)

  • Number of variables (columns)

  • Variable characterstics like formats, informats, labels, type, length etc.

In this tutorial we will make use of SAS' inbuilt dataset: sashelp.baseball

PROC CONTENTS data=sashelp.baseball ;
RUN;

Following is the output:

Out data has 322 rows (Observations), 24 columns (variables). Second table provides the information about their variables.

PROC CONTENTS output








PROC CONTENTS output


















Note that in the second table the order of the variables is in ascending order.

To change the variable list in the order as they appear in the dataset, we write VARNUM. Also we can add a title to our output using TITLE keyword:

PROC CONTENTS data=sashelp.baseball VARNUM;
TITLE 'Baseball players dataset info'
RUN;
PROC CONTENTS output
Title is added in the output using TITLE statement









PROC CONTENTS output
Variables are in the order as they appear in the dataset

Tags: