PROC FREQ In SAS (Complete Guide With 15+ Examples)

PROC FREQ is an essential and most used procedure in SAS primarily for counting, displaying and analysing categorical type data. The PROC FREQ statement invokes the FREQ procedure in SAS. The FREQ procedure produces one-way to N-way frequency and cross-tabulation tables. The statistics for contingency (cross-tabulation) tables include the following: chi-square tests and measures measures … Read more

PROC SUMMARY In SAS

The PROC SUMMARY procedure is used to explore and analyse data not only in terms of count and distribution but also statistically. The SUMMARY and PROC MEANS are quite a similar SAS procedures with two minor differences. The first difference is, PROC MEANS prints a report by default, whereas PROC SUMMARY does not. And the … Read more

How To Delete External Files If It Exists Using SAS Code

This is a very common operation performed in data management. When it comes to deletion of files it is always recommended to have file check logic in place before you attempt to delete files. You can delete files using the FDELETE() function. But before that you must verify if a file exists or not using … Read more

Difference Between DELETE and DROP In SAS

DELETE vs DROP In SAS As a general concept DELETE keyword delete rows from the SAS dataset. It means it only removes observations from the dataset and structure or metadata of that dataset remains intact. Whereas DROP keyword delete entire dataset by physically deleting data files, metadata files and index files if it exists. There … Read more

How To Delete SAS Data sets (5+ Examples)

It’s always the best practice followed that beforeing creating or loading SAS dataset you should first check if it already exists and delete SAS data sets. It’s a standard procedure. There are multiple ways you can delete SAS data sets. You can either delete or drop the dataset. It works more or like the same. … Read more

How To Use _N_ [Automatic Variable] In SAS

_N_ Automatic Variable In SAS: The value for _N_ is initially set to 1. Each time the DATA step loops past the DATA statement, the variable _N_ increments by 1. The value of _N_ represents the number of times the DATA step has iterated. The following sample dataset will be used to demonstrate how to … Read more

How To Use END=last Option To Select Last Observation In SAS

The END= option used in the data step is very powerful to identify the last observation from the SAS dataset. The end= option to tell SAS to create a temporary numeric value whose value is used to detect the last observation. The following sample dataset will be used to show how to use end=last option … Read more

How To Select First and Last Rows (Observations) In SAS

Selection of the first and last observations from the dataset could be a little tricky. You can use the first. and last. variable but it only works with the grouping of the data. It doesn’t work on the entire dataset. But the following options are available in SAS that helps you identify and extract last … Read more

How To Select First N Rows In SAS

In this article you’ll learn 8 different ways with examples on how to select the first N rows in SAS. Sometimes you may want to extract the first 5 observations or just a specific row, let’s say 5th observation, or you may want to extract observations within the specified range. Everything can be achieved using … Read more

How To Identify And Remove Empty Columns In SAS

In SAS you can import data from flat files, and also extract data from various other databases such as sql, oracle, db2, and so on. Sometimes you extract what is not necessary for you. The best example is blank rows coming from source. The empty rows are of no use hence it is important to … Read more