How do I calculate deciles in SAS with an example? 2

How do I calculate deciles in SAS with an example?

Calculating deciles in SAS involves dividing a dataset into 10 equal parts, with each part representing 10% of the total data. This can be achieved by using the PROC UNIVARIATE or PROC RANK procedures in SAS. An example of calculating deciles in SAS would be to use the PROC UNIVARIATE procedure to find the deciles of a dataset containing sales data for a company. This would provide insight into the distribution of sales and identify the sales values at the 10th, 20th, 30th, and so on, up to the 100th percentile. This information can be useful in making business decisions, such as identifying top and bottom performing products or regions.

Calculate Deciles in SAS (With Example)


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 univariatedata=original_data;
    var var1;
    output out=decile_data;
    pctlpts = 10 to 100 by 10pctlpre = 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 printdata=original_data;

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

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

/*view deciles for points*/
proc printdata=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.

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

Cite this article

stats writer (2024). How do I calculate deciles in SAS with an example?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-i-calculate-deciles-in-sas-with-an-example/

stats writer. "How do I calculate deciles in SAS with an example?." PSYCHOLOGICAL SCALES, 26 Jun. 2024, https://scales.arabpsychology.com/stats/how-do-i-calculate-deciles-in-sas-with-an-example/.

stats writer. "How do I calculate deciles in SAS with an example?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-do-i-calculate-deciles-in-sas-with-an-example/.

stats writer (2024) 'How do I calculate deciles in SAS with an example?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-i-calculate-deciles-in-sas-with-an-example/.

[1] stats writer, "How do I calculate deciles in SAS with an example?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How do I calculate deciles in SAS with an example?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top