BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I have a data set with 35000 rows.

In this data set there are following columns:

"Customer ID"

"predicted" with value between 0 and 1 (probability of failure) 

"Failure" with value 1 or 0 (1 if customer fail in 12 months follow up and  0 if not)

 

I want to create a new data set with calculation of percentiles  1 until 100  ( 1,2,3,4,5,6,7,8,.......and so on till 100)

The problem:

In the new column "Percentile_"  there is jumping in the values and I get only the following percentiles

0
1
2
3
4
5
6
7
8
9
11
13
14
15
16
27
38
40
42
43
44
45
46
48
51
52
53
54
55
57
59
60
66
73
74
75
76
78
80
84
88
89
90
91
93
94
95
97
98
99

 

 

proc rank data=Have  groups=100 descending out=b;
var predicted;
ranks Percentile_;
run;

proc summary data=b nway;
var Failure ;
class Percentile_;
output out=d(drop=_type_ rename=(_freq_=n_Percentile))
sum=Bad_Percentile ;
run;

 

 

8 REPLIES 8
Patrick
Opal | Level 21

I assume you've got these "jumps" because of ties. There are different options for Proc Rank how to treat ties.

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0y7jshlj1odi6n1atnqzerl3uw5.htm 

Ronein
Meteorite | Level 14

Sorry,I didnt see solution to my problem in this link

PaigeMiller
Diamond | Level 26

I want to create a new data set with calculation of percentiles 1 until 100 ( 1,2,3,4,5,6,7,8,.......and so on till 100)

 

Percentiles of what?

 

Do you understand that percentiles of 0/1 variables is a meaningless thing to compute?

--
Paige Miller
Ronein
Meteorite | Level 14

Thanks,

Percentiles of  column "predicted"  (Column predicted  get values between 0 and 1 and it is the probability of failure by model)

 

Ronein
Meteorite | Level 14

Percentile of PD (probability of default)

Ksharp
Super User
As Patrick said try option ties=dense

proc rank data=Have groups=100 descending out=b TIES=DENSE ;

Or you could use PROC UNIVARIATE + PCTLPTS + PCTLPRE

Ronein
Meteorite | Level 14

TIES=DENSE is not working well.
It classified to groups in wrong way.
May you please show the code of using PROC UNIVARIATE + PCTLPTS + PCTLPRE?

PaigeMiller
Diamond | Level 26

@Ronein wrote:

TIES=DENSE is not working well.


Show us what is wrong. Don't say something is wrong and provide no explanation.

 

It classified to groups in wrong way.

 

I think it classified the group in the correct way (it did what it was supposed to do), but that may not be what you want. And you need to explain what you want.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 607 views
  • 2 likes
  • 4 in conversation