Search the site...

SASCRUNCH TRAINING
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
Sentry Page Protection
Please Wait...
Proc Contents [2-3]
SAS Base Exam


VARNUM
As shown in the previous session, the CONTENTS procedure prints the list of variables in the data set (3rd table).
Picture
Picture

The VARNUM option changes the order of the variables listed in the table.

Picture

Let's take a look at an example.

Example
Picture

In the XYZ data set, there are 6 variables:
  • X1
  • X2
  • X3
  • A1
  • A2
  • A3

The first variable in the data set is X1, followed by X2, X3, A1, A2 and A3.

Picture

Now, let's run the CONTENTS procedure on the XYZ data set.

Proc Contents Data=XYZ;
Run;

Again, the third table shows the list of variables in the data set.

Picture

Please note that the variables are listed in alphabetical order.

Picture

It is not listed in the order of the variables' position in the data set.
​
Picture

Sometimes, you might want to list the variables by their actual positions in the data set instead.

This can be done by adding the VARNUM option.

Example

Proc Contents Data=XYZ Varnum;
Run;
Picture

The VARNUM option is added to the CONTENTS procedure.

This will list the variables in the order of the variables' position in the data set.
Picture

Exercise
Run the CONTENTS procedure on the FISH data set from the SASHelp library.

Add the correct option so that the variables are listed in the order of their position in the data set.
Next

Need some help?
Get Hint
Get Solution
Fill out my online form.

Home 
​
1 2 3 4 5 6 7
Summary | Final Test | Coding Exercises
Coding Project

Already a member? Go to member's area.