PROC DATASETS - CONTENTS Statement

Setting up the Background

SAS Code:

libname xyz 'D:\SAS_Datasets\';

data xyz.a;

amt = 5600;

run;

data xyz.b;

run;

data xyz.c;

amt = 5600;

run;

data xyz.d;

amt = 5600;

run;

<< Back to the PROC DATASETS Page.

To view the contents of the library we normally use PROC CONTENTS;

However the same result can be achieved using PROC DATASETS as well.

SYNTAX:

proc datasets lib="libname";

CONTENTS;

quit;

EXAMPLE:

Before moving to the actual demonstrations we will set up the environment.

Following code declares one library and creates some SAS datasets inside; just for demo purpose.

amt = 5600;

Now; lets see how one can use PROC DATASETS to view the contents of the library instead of using PROC CONTENTS.

SAS Code: PROC DATASETS - CONTENTS Statement

libname xyz 'D:\SAS_Datasets\';

proc datasets lib=xyz;

contents;

quit;

Following is the output of the code above. (Note, this is just a part of the actual output).

OUTPUT: PROC DATASETS - CONTENTS Statement

The DATASETS Procedure

The same output can be observed if someone chooses to use PROC CONTENTS. Following is the code and output for the same. Which confirms that to view the contents of the library one can use PROC CONTENTS or PROC DATASETS "CONTENT" statement alternatively.

SAS Code: PROC CONTENTS

libname xyz 'D:\SAS_Datasets\';

proc contents lib=xyz._ALL_;

contents;

quit;

And the output using PROC CONTENTS;

OUTPUT: PROC CONTENTS

The CONTENTS Procedure