0% found this document useful (0 votes)
155 views5 pages

Proc Contents

Uploaded by

Ramya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views5 pages

Proc Contents

Uploaded by

Ramya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PROC CONTENTS

Proc contents gives descriptive information for all variables found in


SAS dataset such as type, length, position, format, informat and label.
Using this procedure we can see description information of dataset.
It is useful for document purpose. (Documenting SAS datasets stored in libraries)

Examples:-
PROC CONTENTS DATA=DEMOGRAPHIC_DATA;
RUN;

Options:-
Data: - Specify the input data set
PROC CONTENTS DATA=DEMOGRAPHIC_DATA
RUN;

Out: - Specify the output data set


It creates description information portion in output dataset.
PROC CONTENTS DATA=DEMOGRAPHIC_DATA OUT=DEMOGRAPHIC_DATA2;
RUN;

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com
Position: - Default variables in the dataset are printed out an alphabetic
order, when this position option specified, a second list of variables is
output according to their position in the dataset.

PROC CONTENTS DATA=DEMOGRAPHIC_DATA POSITION;


RUN;
But don’t want in Alphabetic order, Need only list of variables with their attributes
in dataset order use

Varnum: - Print a list of the variables by their logical position in the data
set
PROC CONTENTS DATA=DEMOGRAPHIC_DATA VARNUM;
RUN;

Short: - Prints out only names of variables in SAS dataset.


PROC CONTENTS DATA=DEMOGRAPHIC_DATA SHORT;
RUN;

Default it prints list of variables in Alphabetic order, but need to print in


both alphabetic and dataset order
PROC CONTENTS DATA=DEMOGRAPHIC_DATA SHORT POSITION;
RUN;

Default it prints list of variables in Alphabetic order, but need to print in


only dataset order
PROC CONTENTS DATA=DEMOGRAPHIC_DATA SHORT /*POSITION*/ VARNUM;
RUN;

Noprint: - Suppress the printing of the output


PROC CONTENTS DATA=DEMOGRAPHIC_DATA OUT=DEMOGRAPHIC_DATA2
NOPRINT;
RUN;

Centiles: - Print centiles information for indexed variables


/*SIMPLE INDEX */
PROC SQL;
CREATE INDEX EMP_NAME ON DEMOGRAPHIC_DATA (EMP_NAME);
QUIT;
/* COMPOSITE INDEX*/
PROC SQL;
CREATE INDEX NAME ON DEMOGRAPHIC_DATA
(EMP_NAME,SEX,AGE,HEIGHT,WEIGHT);
QUIT;
PROC CONTENTS DATA= DEMOGRAPHIC_DATA CENTILES;

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com
RUN;

Out2:- Specify the name of an output data set to contain information about
indexes and integrity constraints
PROC CONTENTS DATA= DEMOGRAPHIC_DATA OUT =DEMO1 OUT2=DEMO2;
RUN;

Data=_all_:- Prints descriptor information for all the datasets in library.


PROC CONTENTS DATA=WORK._ALL_;
RUN;

NODS:-Suppress the printing of individual files


NODS can use with only _ALL_.
PROC CONTENTS DATA=WORK._ALL_ NODS;
RUN;

FMTLEN: - Print the length of a variable's informat or format


PROC CONTENTS DATA= DEMOGRAPHIC_DATA FMTLEN;
RUN;

Directory: - Print a list of the SAS files in the SAS library


PROC CONTENTS DATA=DS DIRECTORY;
RUN;

How can you Calculate Data Set Size


To estimate the amount of disk space that is needed for a SAS data set:

Create a dummy SAS data set that contains one observation and the variables that
you need run the CONTENTS procedure using the dummy data set

Determine the data set size by performing simple math using information from the
CONTENTS procedure output.

For example, for a data set with one character variable and four numeric variables,
you would submit the following statements:
Data oranges;
Input variety $ flavor texture looks;
Total=flavor+texture+looks;
Datalines;
Navel 9 8 6
;
Run;
Proc contents data=oranges;
Title 'Example for Calculating Data Set Size';

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com
Run;
These statements generate the output shown in Example for Calculating Data Set
Size with PROC CONTENTS.

Example for Calculating Data Set Size with PROC CONTENTS


Example for Calculating Data Set Size 1
The CONTENTS Procedure

Engine/Host Information

-----Alphabetic List of Variables and Attributes-----

The size of the resulting data set depends on the data set page size and the
number of observations. You can use your PROC CONTENTS output and the
following formula to estimate the data set size: number of data pages = 1 + (floor
(Observations / Max Obs per Page))
Size = 256 + (Data Set Page Size * number of data pages)
(Floor represents a function that rounds the value down to the nearest integer.)

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com
Taking the information that is shown in Example for Calculating Data Set Size with
PROC CONTENTS, you can calculate the size of the example data set: number of
data pages = 1 + (floor(1/101))
Size = 256 + (4096 * 1) = 4352

Thus, the example data set uses 4,352 bytes of storage space.

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com

You might also like