# PROC FREQ in SAS Explained

PROC FREQ in SAS is used to find the frequency tablePROC FREQ with condition using WHERE Clause; frequency table without cumulative and percentage; Let’s see an example for PROC FREQ with Graph; PROC FREQ with sort. PROC FREQ for cross tables by removing unwanted statistics using norow nocum nopercent . PROC FREQ store the results of frequency table etc.

• PROC FREQ in SAS – Frequency Table in SAS
• PROC FREQ in SAS without cumulative
• PROC FREQ in SAS without cumulative and without percentage
• PROC FREQ with condition with WHERE Clause
• PROC FREQ in SAS with Graph
• Two way Frequency table or Cross table using PROC FREQ
• PROC FREQ and Sort in SAS
• Count Missing values in SAS using PROC FREQ
• PROC FREQ remove unwanted statistics in SAS using norow nocum nopercent
• PROC FREQ store the result of frequency table in SAS

So we will be using CARS Table in our example #### Frequency Table of Single column – PROC FREQ

Frequency table of the column in SAS is obtained by using PROC FREQ along with table keyword as shown below

```/* Frequency table - proc freq */

proc freq data=cars;
table MAKE;
run;

```

Frequency of “MAKE” column will be #### Frequency Table without cumulative – PROC FREQ without cumulative

Frequency table of the column in SAS is obtained by using PROC FREQ along with table keyword as shown below. nocum keyword renders the frequency table without cumulative frequency calculations

```
/* Frequency table without cumulative - proc freq */

proc freq data=cars;
table MAKE / nocum;
run;

```

Frequency of “MAKE” column will be #### Frequency Table without cumulative and without percentage – PROC FREQ only Value and Frequency

Frequency table of the column in SAS is obtained by using PROC FREQ along with table keyword as shown below. Nocum and nopercentage keyword renders the frequency table without cumulative frequency and without percentage calculations

```
/* Frequency table without cumulative and without percentage - proc freq */

proc freq data=cars;
table MAKE / nocum nopercent;
run;

```

Frequency of “MAKE” column with unwanted statistics removed will be #### Frequency Table with Condition – PROC FREQ with WHERE Clause

Frequency table of the column in SAS is obtained by using PROC FREQ along with table keyword as shown below along with where clause which provides condition.

```
/* Frequency table proc freq where */

proc freq data=cars;
where Luxury=1;
table MAKE /nocum;
run;

```

Frequency of “MAKE” column with where condition will be #### Frequency Table distinct count – PROC FREQ  Distinct count

Frequency table of the column in SAS is obtained by using PROC FREQ along with table keyword along with nlevels will be.

```
/* Frequency table distinct count- proc freq*/

proc freq data=cars nlevels;
table MAKE / nocum nopercent;
run;

```

Frequency of “MAKE” column will be #### Frequency Table Graph  – PROC FREQ  Graph

Frequency table along with Graph of the column in SAS is obtained by using PROC FREQ along with table keyword along with plots will be

```
/* Frequency table graph - proc freq */

Ods graphics on;proc freq data=cars order=freq;
Tables MAKE/ plots=freqplot (type=bar scale=percent);
run;
Ods graphics off;

```

So the resultant frequency table plot will be #### Frequency Table – Sort on Frequency –  PROC FREQ Sort

Frequency table  of the column in SAS is obtained by using PROC FREQ along with table keyword. Order keyword is used to order the frequency table as shown below

```/* Frequency table sort on order of frequency - proc freq */

proc freq data=cars order = FREQ;
Tables MAKE / nocum nopercent;
run;

```

So the resultant frequency table which is sorted will be #### Cross Table : Two way Frequency table –  PROC FREQ

Cross table which is two way frequency table of MAKE and LUXURY column is shown below

```
/* cross table - proc freq */

proc freq data=cars;
table MAKE * LUXURY;
run;

``` #### Cross Table List –  PROC FREQ  LIST

Two way frequency table can be converted to list using list keyword as shown below

```/* cross table as list - proc freq */

proc freq data=cars;
table MAKE * LUXURY / list;
run;

``` #### Cross Table – PROC FREQ –  Hide unwanted Statistics

norow nocol nopercent removes unwanted statistcs while calculating the frequency table as shown below

```
/* cross table hide unwanted statistics - proc freq */

proc freq data=cars;
table MAKE * LUXURY /norow nocol nopercent;
run;

```

so the resultant table with percentage and cumulative removed will be #### Cross Table store as table – PROC FREQ – Store Results

We can store the results of frequency table by OUT keyword as shown below

```/*** Cross table store result in sas dataset- proc freq */

proc freq data=cars noprint;
table MAKE * LUXURY / out = temp;
run;

```

So the frequency table is shown in the name of “temp” ## Author

• With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.