PROC CONTENTS - SUMMARIZING DATASET CONTENTS | METADATA | SAS PROCS

PROC CONTENTS In SAS is used to summarize a dataset's contents and metadata, generated summary about the contents of a dataset includes :

  • All variable names, their types, and attributes of Variables (including formats, informats, and labels)
  • Display the Number of Observation in Dataset
  • Number of Variables in Dataset
  • When the dataset was created
  • And lot more Information about any Dataset

Syntax for PROC CONTENTS

PROC CONTENTS DATA=DatasetName <option(s)>;
<Optional Statements>
Run;

Example- 

PROC Contents Data=SASHELP.cars;
 title  'The Contents of the CARS Data Set';
run;

Proc Content


Available Options for PROC CONTENTS 


DIRECTORY

prints a list of all tables in the specified library. 


DETAILS | NODETAILS

Print additional Details of All Tables, This Details Option is always used along with Directory option. 

DefaultIf DETAILS and NODETAILS are not specified, the default value option considered as NODETAILS

        Example- 

PROC Contents Data=SASHELP.cars DIRECTORY DETAILS;
 title  'The Contents of the CARS Data Set';
run;

 

OUT=table-name

Store the Output in a specified Table/Dataset, OUT= does not suppress the printed output from the statement. If you want to suppress the printed output, you must use the NOPRINT option.


        Example- 

PROC Contents Data=SASHELP.cars  out=Cars_details;
 title  'The Contents of the CARS Data Set';
run;

 

Cars Details CONTENTs PROC
It Also Prints the PROC CONTENTS output in Result window.

NOPRINT

NOPRINT OPTION use to suppresses printing the output of the CONTENTS procedure.

SHORT

prints only the list of variable names for the table, If the list of variables is more than 32,767 characters, the list is truncated and a WARNING is written to the log. To get a complete list of the variables, request an alphabetical listing of the variables.

        Example- 

PROC Contents Data=SASHELP.cars  SHORT;
 title  'The Contents of the CARS Data Set';
run;

Sort Option in PROC CONTENTS


VARNUM

prints a list of the variable names in the order of their logical position in the table. The physical position of the variable in the table is engine-dependent.

        Example- 

PROC Contents Data=SASHELP.cars  VARNUM;
 title  'The Contents of the CARS Data Set';
run;

Varnum option in PROC CONTENTS

 

ORDER=COLLATE | CASECOLLATE | IGNORECASE | VARNUM

COLLATE

prints a list of variables in alphabetical order beginning with uppercase and then lowercase names.

CASECOLLATE

prints a list of variables in alphabetical order even if they include mixed-case names and numerics.

IGNORECASE

prints a list of variables in alphabetical order ignoring the case of the letters.

VARNUM

is the same as the VARNUM option.

NoteThe ORDER= option does not affect the order of the OUT= table.
 

Post a Comment

0 Comments