DATA Step, Macro, Functions and more

Calculate percentile based on Z-score

Accepted Solution Solved
Reply
Super Contributor
Posts: 263
Accepted Solution

Calculate percentile based on Z-score

[ Edited ]

Hi guys, I'd like to calculate percentile based on z-score. My data is massive where using z-score-percentile conversion table is futile. Please help? Below is first few observation of my data. Thanks!!!! 

 

data p.temp; 
input zcore;
cards;
0.16
3.1
-0.33
1.72
;

 


Accepted Solutions
Solution
3 weeks ago
Respected Advisor
Posts: 2,661

Re: Calculate percentile based on Z-score


All Replies
Solution
3 weeks ago
Respected Advisor
Posts: 2,661

Re: Calculate percentile based on Z-score

Super Contributor
Posts: 263

Re: Calculate percentile based on Z-score

Posted in reply to PaigeMiller

Thanks a lot @PaigeMiller.

 

data temp1; set temp;
pctl=probnorm(zcore);
run;

zcore  pctl

 

0.16    0.56

3.1      0.99

-0.33   0.37

1.7      0.96

 

Please correct me if I'm wrong. But it looks like it. I will double check with the conversion table as well.

Super User
Posts: 10,623

Re: Calculate percentile based on Z-score

Function PROBNORM() is too old ,Check CDF().

 

data temp; 
input zcore;
p=cdf('normal',zcore);
cards;
0.16
3.1
-0.33
1.72
;

proc print;run;
Respected Advisor
Posts: 2,661

Re: Calculate percentile based on Z-score

Too old? What risk does this pose to the user? The function is still supported by SAS, and the probabilities of a normal distribution haven't changed.

--
Paige Miller
Super User
Posts: 10,623

Re: Calculate percentile based on Z-score

Posted in reply to PaigeMiller

It is better to explain by @Rick_SAS

Trusted Advisor
Posts: 1,137

Re: Calculate percentile based on Z-score

Yes, there is a caveat regarding the "older" PROBXXX functions in Rick's Blog ("The DO Loop"). Just found it again: https://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html (at the bottom of the blog entry).

Respected Advisor
Posts: 2,661

Re: Calculate percentile based on Z-score

Posted in reply to FreelanceReinhard

Thank you for the link, @FreelanceReinhard. That's very interesting.

 

If I am understanding properly, the new functions will perform better when  you have very small or very large values, but in the range of –10 to +10, I just wrote a program and PROBNORM(x) and CDF('normal',x) give the same answers (at least to 14 decimal places).

 

In any event, SAS ought to update the PROBNORM (and similar functions) documentation to specifically say that users ought to use the newer CDF function, and state the reasons.

--
Paige Miller
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 118 views
  • 3 likes
  • 4 in conversation