4 C
London
Friday, December 20, 2024
HomeSASDescriptive Statistics in SASHow to Calculate Deciles in SAS (With Example)

How to Calculate Deciles in SAS (With Example)

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

In statistics, deciles are numbers that split a dataset into ten groups of equal frequency.

The first decile is the point where 10% of all data values lie below it.

The second decile is the point where 20% of all data values lie below it, and so forth.

You can use the following basic syntax to calculate the deciles for a dataset in SAS:

/*calculate decile values for variable called var1*/
proc univariate data=original_data;
    var var1;
    output out=decile_data;
    pctlpts = 10 to 100 by 10
    pctlpre = D_;
run;

Note: The pctlpts statement specifies which deciles to calculate and the pctlpre statement specifies the prefix to use for the deciles in the output.

The following example shows how to use this syntax in practice.

Example: How to Calculate Deciles in SAS

Suppose we have the following dataset in SAS that contains two variables:

/*create dataset*/
data original_data;
    input team $ points;
    datalines;
A 12
A 15
A 16
A 21
A 22
A 25
A 29
A 31
B 16
B 22
B 25
B 29
B 30
B 31
B 33
B 38
;
run;

/*view dataset*/
proc print data=original_data;

The following code shows how to calculate the deciles for the points variable in the dataset

/*calculate decile values for points*/
proc univariate data=original_data;
    var points;
    output out=decile_data
    pctlpts = 10 to 100 by 10
    pctlpre = D_;
run;

/*view deciles for points*/
proc print data=decile_data;

Here’s how to interpret the output:

  • The value of the first decile is 15.
  • The value of the second decile is 16.
  • The value of the third decile is 21.
  • The value of the fourth decile is 22.

And so on.

Additional Resources

The following tutorials explain how to perform other common tasks in SAS:

How to Calculate Percentiles in SAS
How to Calculate Quartiles in SAS
How to Use Proc Summary in SAS

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories