Working on Sample data set in SAS

In this blog, let’s learn how to work on a permanent data set. We will work on Cars data set which is a sample file in SASHELP Library. We create a copy of this data set called Cars2 in work library.

We must get into the details of each SAS statement:

Data statement – defines a new data set called cars(this is stored in work library now, lets check).

Set statement – specifies that we are reading data from cars file in SASHELP library.

Run statement – simply enables running of the program.

Let’s check the Log:

Before analyzing a data set we must look at the variables and the observations.





How to get the first and last observations?

Printing first ten observations: The Proc statement below asks SAS to print first ten observations from cars2. Obs data set option when solely mentioned, assumes observations upto ten.


Printing last ten observations : We know that cars2 data set has 428 observations(check the log). Firstobs data set options defines the first observation to be processed. Obs data set option defines the last observation to be processed.







Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s