BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Stepik
Obsidian | Level 7

Team, I tri to use the formula for calculating:

G = QUANTILE('NORMAL', pd). pd has different values, also of 1.

 

Unfortunately, the log gives me the next error

Stepik_0-1688644020680.png

 

Does this mean that the function can not provide inverse cumulative distribution function of a real number?

 

Stepik

1 ACCEPTED SOLUTION

Accepted Solutions
Stepik
Obsidian | Level 7

Solved taking pd=1 separately

View solution in original post

7 REPLIES 7
Stepik
Obsidian | Level 7
of a real number = 1
Ksharp
Super User

Your argument of QUANTILE() is not right .

since it is a P value, it should be (0,1).

 

data have;
input pd;
cards;
.1
.2
.3
.4
;


data _null_;
set have;
G = QUANTILE('NORMAL', pd);
put G= pd=;
run;
38   ;
39
40
41   data _null_;
42   set have;
43   G = QUANTILE('NORMAL', pd);
44   put G= pd=;
45   run;

G=-1.281551566 pd=0.1
G=-0.841621234 pd=0.2
G=-0.524400513 pd=0.3
G=-0.253347103 pd=0.4
NOTE: 从数据集 WORK.HAVE. 读取了 4 个观测
NOTE: “DATA 语句”所用时间(总处理时间):
      实际时间          0.01 秒
      CPU 时间          0.00 秒

Stepik
Obsidian | Level 7

Solved taking pd=1 separately

Ksharp
Super User

Sorry. I have to leave now. I will take a look tomorrow.

But maybe @Rick_SAS  could give you a hand. He is good at this.

Ksharp
Super User
And also better post sas dataset " R.Cov" . As I said you can't have pd_ap=1 in it.
FreelanceReinh
Jade | Level 19

Hello @Stepik,

 

I think you just need to handle the cases pd=0 and pd=1 separately in the calculation of G and N:

 

if pd in (0 1) then N=pd;
else do;
  G = QUANTILE('NORMAL', pd); 
  N = CDF('NORMAL', G/SQRT(1-R)+SQRT(R/(1-R))*QUANTILE('NORMAL',0.999));
end;

 

 

Alternatively, since N=pd implies RWA1=0, you can also put the entire block of your assignment statements into the ELSE branch:

 

if pd in (0 1) then RWA1=0;
else do;
  ... your code ...
end;

(before the RETURN statement).

 

Stepik
Obsidian | Level 7
I did it separately indeed for pd=1. thanks

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2571 views
  • 3 likes
  • 3 in conversation