SAS Studio Workshop - Proc Content

SAS Studio Overview :

First , we create a new folder to store SAS datasets . We click on "Server Files and Folders " tab on left viewing pane of SAS window as :

 

We click on Files(Home) to open files stored in it . We right click on Files tab and click on New and then click on Folder to create a new folder .

It will open the following pane as :

We give the name of folder and click on Save button to save the folder .

We can upload files by right click on learn folder and click on Upload Files as:

 

It will open following pane :




 

 

We can click on Choose Files button to choose SAS dataset to upload . It open following open pane :

 

We can choose SAS dataset and click on Open button . It will upload dataset in learn folder. You can see we upload lots of SAS dataset in learn folder.

 

We right click on lean folder and click on Create tab and then click on Library to create a new library to store SAS dataset .

 

It will open given pane :

 

We create a new library "LEARN" . We give the name of library and click on OK button to create it. We  can checked the Re-create option to recreate the library whenever we start our SAS studio . We can see LEARN library in Libraries tab under My Libraries as :

We can use any of SAS files under LEARN library to work onwards .

 

The CONTENTS procedure

The CONTENT procedure allows us to create a SAS output that describes either the contents of a SAS library or the descriptor information of a SAS data set . In order to view the contents of a SAS library , we use following code :

PROC CONTENTS data = libref._ALL_ NODS;

RUN;

Where :

libref - it is the library name .

_ALL_ - option requests a listing of all the SAS files in the library .

NODS - it stands for "no details" , it is used to suppress the printing of detailed information about each file when you specify the _ALL_ option .

 

We want to explore contents of baseball dataset . We used following code :

proc contents data=learn.baseball ;

run;

It shows the number of observations in the dataset . Here , the baseball dataset contains 322 observations.

The number of variables in the dataset . Here , baseball dataset contains 22 variables.

The date and time that the dataset was created and last modified.

It shows the dataset's variables and their attributes .

# - The original order of the variable in the columns of the dataset

Type - Whether the variable is numeric or character

Len - It represents length of the variable

Format - The assigned format of the variable

Informat - The format of the variable when it was read into SAS

Label - The label associated with variable . If variables do not have labels, this column will be identical to the variable name .

OUTPUT:

It shows alphabetic list of variables and attributes .

 

We can use directory option to see all the dataset in learn library .

proc contents data=learn.sales directory;

run;

 

OUTPUT:

It shows Directory where datasets stored :

It shows all the dataset in learn library :

It shows contents of sales dataset :

 

We use following statements:

data = learn._all_  represents all datasets in learn library .

nods - option suppress the printing of detailed information about each dataset in learn library .

It shows only list of datasets in learn library :

proc contents data= learn._all_ nods;

run;

OUTPUT:

 

We check out the attributes of dataset and variables .

proc contents data=learn.sales ;

run;

OUTPUT:

We used nodetails option on sales dataset . It shows same output of alphabetic list of variables and attributes .

 

proc contents data=learn.sales nodetails;

run;

OUTPUT:


 

We use short option to see alphabetic list of variable names .

The following code shows the alphabetic list of variable names of sales dataset :

proc contents data=learn.sales short;

run;

OUTPUT:

We used varnum option to see variables in creation order with attributes .

proc contents data=learn.sales varnum ;

run;

OUTPUT:

 

We used combination of two options varnum and short . It shows variable names of sales dataset in creation order .

proc contents data=learn.sales varnum short;

run;

OUTPUT:

We used position option to see both alphabetic and creation order list of variables and attributes .

proc contents data=learn.sales position;

run;

OUTPUT:

 

We used two options position and short . It will show variables names in alphabetic and creation order .

proc contents data=learn.sales position short;

run;

OUTPUT:

 

We use short option to show the alphabetic list of variables names of all datasets in learn library .

proc contents data=learn._all_ short;

run;

OUTPUT:

We use varnum option to see list of variables in creation order of all datasets in learn library .

proc contents data=learn._all_ varnum;

run;

OUTPUT:

It shows the list of datasets in learn library :

 

It shows the contents of all the datasets :

 

We used varnum and short options to see list of variables in creation order of all datasets in learn library.  

proc contents data=learn._all_ varnum short;

run;

OUTPUT:

We can see all the datasets in learn library with nods option .

proc contents data=learn._all_ nods;

run;

OUTPUT:

 

* export the variable names and their position number into a data set called "data_info";

We used following options as :

noprint  - to not print output in results window .

out = data_info tells SAS to save output in data_info dataset .

keep = name varnum tells SAS to keep only name and varnum variables in data_info dataset .

 

proc contents     data = sashelp.class    noprint   out = data_info (keep = name varnum);

run;

OUTPUT:


 

Subscribe to our mailing list

* indicates required

Looking for Corporate Training ? Reach out to us at Akriti.Lal@instrovate.com

Reach out to us if you are looking for Corporate Training to Build The Next Generation Analytical Workforce with an in-depth understanding of  Exploratory Data Analysis , Data Visualisation, Data Analytics , AI First , Machine Learning & Deep Learning Training & Consulting helping them to take Data Informed Decision at each stage of the business. 

We understand that At the present times , the Entire Industry is in a Tranformation stage with the Softwares  being rebuilt with Artificial Intelligence Capabilities .

We need SMART WORKFORCE for the SMART SOFTWARES to reap the maximum return . 

 

Whatsapp at +91-9953805788 or email at - akriti.lal@instrovate.com if you would like to know more . 

 

  • Corporate Tableau Training in Gurgaon
  • Corporate Data Analytics Training in Gurgaon
  • Corporate Microsoft Power BI Training in Gurgaon
  • Corporate Microstrategy Training in Gurgaon
  • Corporate Google Data Studio Training in Gurgaon
  • Corporate Python Training in Gurgaon
  • Corporate Advance Analytics in R Programming Training in Gurgaon
  • Corporate Machine Learning Training in Gurgaon
  • Corporate Deep Learning Training in Gurgaon
  • Corporate Data Visualization Training in Gurgaon

 

Address

Instrovate Technologies

Noida, Gurgaon

 

akriti.lal@instrovate.com 

Hit Your Refresh Button To Rise Higher
Print Print | Sitemap
All rights reserved @ Instrovate Technologies
GSTIN : 09AAECI6862K1Z1

Terms Of Services    Privacy Policy    Disclaimer     Refund Policy    


Call

E-mail