I am trying to create percentiles through Proc Univariate and I am using the below code
proc univariate data=abdef;
output out = data5 pctlpre=Total_AMT_P_ pctlpts= 0.9 to 99.9 by 10 ;
What I am also trying to do is that I want to create some standard descriptive statistics at each decile like min, max, mean, std etc.
Could you please help as to how that can be created or will I have to use something else.
can you elaborate on what you mean by calculating deciles.
I thought the deciles are getting calculated in my code when i use
pctlpre=Total_AMT_P_ pctlpts= 0.9 to 99.9 by 10
I have the deciles, just need now the statistics such as min, max, mean, std
The code I mentioned above gives me the below table. It doesnt provides descriptive statistics at each decile.
for ex: min, max, mean, std for each of the 10 deciles below.
If you have a code, kindly share.
Oh...you first need to categorize each observation as being within a specific decile group so you can then calculate summary stats. Personally I prefer proc RANK for categorizing data. There isn't an option you can specify to get what you want.
You were doing from 0.9 to 99.9 so were you trying to trim outliers? Unevenly isn't common....
i am flexible on the deciles, I think at this point in time willing to work with the default deciles as well, but hoping to get the descriptive statistics at each decile in a format where the deciles goes horizontally over the top and the statistics goes vertically in the file (min, max, mean, std) for each decile.
I am guessing I will have to write some custom piece of code to write that. Will explore proc rank as well.
Actually you may not need custom code
Use proc RANK with 10 groups to get 10 deciles.
The use proc tabulate to generate your summaries - this generates a report, displayed output not a dataset. If you want a dataset use PROC means or univariate and then proc transpose. So semi custom if you need a dataset with the output.
Look at this example for how to use PROC RANK and PROC MEANS. It is not clear to me how you want to use the CLASS variable in your example, but this should get you started:
proc rank data=sashelp.cars out=cars groups=10 ; var mpg_city; ranks Rank; run; proc means data=cars; class Rank Origin; var mpg_highway weight length; run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.